This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[COMMITTED PATCH] select_source_symtab: Rewrite to use ALL_SYMTABS.


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;
 	}
     }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]