Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Iniparser Rewrite #2012

Closed
wzdev-ci opened this issue Jul 22, 2010 · 14 comments
Closed

Iniparser Rewrite #2012

wzdev-ci opened this issue Jul 22, 2010 · 14 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_patch (an actual patch, not a request for one) | by EvilGuru


Attached is my rewrite of the iniparser. Included with the patch are unit tests (which must be run manually as adding them to src/main.c causes them not to execute on account of prior tests failing) and a port of existing iniparses users.

Feedback welcome.


Issue migrated from trac:2012 at 2022-04-15 22:08:45 -0700

@wzdev-ci
Copy link
Contributor Author

EvilGuru uploaded file iniparsernew.patch (54.0 KiB)

@wzdev-ci
Copy link
Contributor Author

Per commented


I would love to hear why you rewrote it, and how it is different. And why you hate comments so much ;-)

@wzdev-ci
Copy link
Contributor Author

dak180 changed _comment0 which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

EvilGuru commented


The old one made it very difficult to work with sections as you had to go and prefix everything so:

[foo]
bar = spam

requires "foo:bar" as the key. If you're dynamically generating sections (as I do for stored templates) this is a pain as you need sstrcat calls all over the place.

So far as the design went: the dictionary/iniparser distinction was annoying. As were the some of the function names like iniparser_dump. My API should be more consistent and intuitive.

As for why I hate comments: no comment. (But you saw that coming, now, didn't you ;)

@wzdev-ci
Copy link
Contributor Author

Safety0ff uploaded file ini2.diff (55.2 KiB)

@wzdev-ci
Copy link
Contributor Author

Safety0ff commented


ini2.diff

Fix challenges by converting key's to lower case (since they are converted to lower case in iniparser_line)

Note: I didn't fix all possible case sensitivity issues!

Changed PHYSFS_fgets and stuffed it into physfs_ext.h.

Added prototypes for utility functions and put them at the end of the file.

@wzdev-ci
Copy link
Contributor Author

Safety0ff uploaded file ini3.diff (55.5 KiB)

Added Case insensitivity unit test, added case insensitivity to sections

@wzdev-ci
Copy link
Contributor Author

Safety0ff uploaded file ini3.2.diff (55.5 KiB)

Improve case insensitivity selftest

@wzdev-ci
Copy link
Contributor Author

EvilGuru uploaded file ini4.diff (59.1 KiB)

Updated patch; better error handling and documentation.

@wzdev-ci
Copy link
Contributor Author

EvilGuru commented


I've uploaded an updated version of the path. If there are no further suggestions I'll commit it sometime tomorrow.

P.S. The original author needs to look up the term "buffer overflow."

@wzdev-ci
Copy link
Contributor Author

anonymous uploaded file config (0.7 KiB)

@wzdev-ci
Copy link
Contributor Author

anonymous uploaded file ini5.diff (61.2 KiB)

@wzdev-ci
Copy link
Contributor Author

Per changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Per changed resolution from `` to fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant