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 | 500a877227078c7c386d4b2de2c079de33a674ee (patch) | |
tree | c09d7a49bdcc7a29d2ce5929ff2b12f160406e46 | |
parent | 8bd8b20fef2307147a24aa5bd3106cdd96cec4c1 (diff) | |
download | sssd-500a877227078c7c386d4b2de2c079de33a674ee.tar.gz sssd-500a877227078c7c386d4b2de2c079de33a674ee.tar.bz2 sssd-500a877227078c7c386d4b2de2c079de33a674ee.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.
-rw-r--r-- | common/ini/ini_config.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/ini/ini_config.c b/common/ini/ini_config.c index c28c6489..8c54ad5c 100644 --- a/common/ini/ini_config.c +++ b/common/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); |