summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-04-16 22:11:25 -0400
committerSimo Sorce <ssorce@redhat.com>2009-04-17 15:57:13 -0400
commit500a877227078c7c386d4b2de2c079de33a674ee (patch)
treec09d7a49bdcc7a29d2ce5929ff2b12f160406e46
parent8bd8b20fef2307147a24aa5bd3106cdd96cec4c1 (diff)
downloadsssd-500a877227078c7c386d4b2de2c079de33a674ee.tar.gz
sssd-500a877227078c7c386d4b2de2c079de33a674ee.tar.xz
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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/ini/ini_config.c b/common/ini/ini_config.c
index c28c6489e..8c54ad5cc 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);