From 500a877227078c7c386d4b2de2c079de33a674ee Mon Sep 17 00:00:00 2001
From: Dmitri Pal <dpal@redhat.com>
Date: Thu, 16 Apr 2009 22:11:25 -0400
Subject: 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.
---
 common/ini/ini_config.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'common')

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);
-- 
cgit