diff options
author | Dmitri Pal <dpal@redhat.com> | 2009-04-16 22:11:25 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-04-17 15:57:13 -0400 |
commit | 7b5f297ac811213629789924cf7f69e520185e98 (patch) | |
tree | 3c239a8a03cb99e0c140df348742c3a50874b463 /ini | |
parent | 10035f6c63e3ad2a1805c14dd30f53296a6a97b3 (diff) | |
download | ding-libs2-7b5f297ac811213629789924cf7f69e520185e98.tar.gz ding-libs2-7b5f297ac811213629789924cf7f69e520185e98.tar.xz ding-libs2-7b5f297ac811213629789924cf7f69e520185e98.zip |
INI parser. Fix for line numbers.
Realized that I need to differentiate
sections and attributes. To do this the
line numbers for sections will be negative.
Diffstat (limited to 'ini')
-rw-r--r-- | ini/ini_config.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ini/ini_config.c b/ini/ini_config.c index c28c648..8c54ad5 100644 --- a/ini/ini_config.c +++ b/ini/ini_config.c @@ -295,7 +295,10 @@ static int ini_to_collection(const char *filename, case RET_SECTION: /* Add line to the collection of lines */ if (lines) { - error = add_int_property(*lines, NULL, key, line); + /* For easier search make line numbers for the sections negative. + * This would allow differentiating sections and attributes. + */ + error = add_int_property(*lines, NULL, key, -1 * line); if (error) { TRACE_ERROR_NUMBER("Failed to add line to line collection", error); fclose(file); |