This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[COMMITTED PATCH] select_source_symtab: Rewrite to use ALL_SYMTABS.
- From: Doug Evans <xdje42 at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 10 Nov 2014 16:52:42 -0800
- Subject: [COMMITTED PATCH] select_source_symtab: Rewrite to use ALL_SYMTABS.
- Authentication-results: sourceware.org; auth=none
Hi.
This is just a simple cleanup.
The function is looping over all objfiles with ALL_OBJFILES
and then handcoding the loop over all symtabs.
This can be replaced with ALL_SYMTABS.
Committed.
2014-11-10 Doug Evans <xdje42@gmail.com>
* source.c (select_source_symtab): Rewrite to use ALL_SYMTABS.
diff --git a/gdb/source.c b/gdb/source.c
index 19c2562..1bb19c9 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -291,19 +291,16 @@ select_source_symtab (struct symtab *s)
current_source_line = 1;
- ALL_OBJFILES (ofp)
+ ALL_SYMTABS (ofp, s)
{
- for (s = ofp->symtabs; s; s = s->next)
- {
- const char *name = s->filename;
- int len = strlen (name);
+ const char *name = s->filename;
+ int len = strlen (name);
- if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
- || strcmp (name, "<<C++-namespaces>>") == 0)))
- {
- current_source_pspace = current_program_space;
- current_source_symtab = s;
- }
+ if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
+ || strcmp (name, "<<C++-namespaces>>") == 0)))
+ {
+ current_source_pspace = current_program_space;
+ current_source_symtab = s;
}
}