I needed to revisit this over the past couple days and so I've made a number of changes and improvements to the code. The interface remains mostly the same, with the addition of some new functions:
- cfg_set_array() - set multiple key/value pairs in one call
- cfg_delete_array() - delete multiple keys in one call
- cfg_prune() - "trim" the cfg_struct to only the whitelisted keys the user wants
- cfg_get_keys() - return a list of all keys currently stored in the struct
Other minor improvements include better handling of NULL values on input, and the file is no longer loaded in reverse order (so the load / save should not change the file any more).
I've updated the downloads, webpage, and Doxygen manual with the changes. Remember, the current home of cfg_parse is still the Sourceforge page here:
https://cfg-parse.sourceforge.io/
If anyone wants to do a code review I'd love another set of eyes.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.