This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] symtab.c: Set "first" to zero.
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Mon, 9 Jul 2012 17:33:23 -0700 (PDT)
- Subject: [RFA] symtab.c: Set "first" to zero.
Hi.
The "first" argument to filename_seen is used to control the
initialization of the data structure used to track whether
a file name has been seen yet.
But these two routines don't set it to zero after calling
filename_seen so the data structure is continually reinitialized
resulting in duplicate names in the output.
The completion machinery does its own duplicate elimination so
the effect of this bug is hidden. I just noticed it while browsing the code.
Ok to check in?
2012-07-09 Doug Evans <dje@google.com>
* symtab.c (maybe_add_partial_symtab_filename): Set "first" to zero
after calling filename_seen.
(make_source_files_completion_list): Ditto.
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.316
diff -u -p -r1.316 symtab.c
--- symtab.c 29 Jun 2012 22:46:45 -0000 1.316
+++ symtab.c 9 Jul 2012 23:46:45 -0000
@@ -4576,6 +4576,7 @@ maybe_add_partial_symtab_filename (const
&& filename_ncmp (base_name, data->text, data->text_len) == 0)
add_filename_to_list (base_name, data->text, data->word, data->list);
}
+ *data->first = 0;
}
/* Return a vector of all source files whose names begin with matching
@@ -4623,6 +4624,7 @@ make_source_files_completion_list (char
&& filename_ncmp (base_name, text, text_len) == 0)
add_filename_to_list (base_name, text, word, &list);
}
+ first = 0;
}
datum.first = &first;