Skip to content

Commit

Permalink
INI parser. Fix for line numbers.
Browse files Browse the repository at this point in the history
Realized that I need to differentiate
sections and attributes. To do this the
line numbers for sections will be negative.
  • Loading branch information
Dmitri Pal authored and simo5 committed Apr 17, 2009
1 parent 8bd8b20 commit 500a877
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common/ini/ini_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 500a877

Please sign in to comment.