2012-06-02 Sergio Durigan Junior <sergiodj@redhat.com>
authorSergio Durigan Junior <sergiodj@redhat.com>
Sat, 2 Jun 2012 04:34:23 +0000 (04:34 +0000)
committerSergio Durigan Junior <sergiodj@redhat.com>
Sat, 2 Jun 2012 04:34:23 +0000 (04:34 +0000)
* symtab.c (symbol_demangled_name): New variable `dem_name'.  Use
it to optimize resolution of demangled name.

gdb/ChangeLog
gdb/symtab.c

index 84ec8f096eb95eb6728559feb50cfb48d8873417..024a139e966d8cce5459cadf09b715b05e79dc59 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-02  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       * symtab.c (symbol_demangled_name): New variable `dem_name'.  Use
+       it to optimize resolution of demangled name.
+
 2012-06-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * configure.ac (development): Define new variable.
index 85ddd1dfb39ef23aa42e0e725ce91513e11ffb08..5eb7ced18709f732fedbec272bcad3421ea2ab64 100644 (file)
@@ -850,6 +850,8 @@ symbol_natural_name (const struct general_symbol_info *gsymbol)
 const char *
 symbol_demangled_name (const struct general_symbol_info *gsymbol)
 {
+  const char *dem_name = NULL;
+
   switch (gsymbol->language)
     {
     case language_cplus:
@@ -858,19 +860,17 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol)
     case language_java:
     case language_objc:
     case language_fortran:
-      if (symbol_get_demangled_name (gsymbol) != NULL)
-       return symbol_get_demangled_name (gsymbol);
+      dem_name = symbol_get_demangled_name (gsymbol);
       break;
     case language_ada:
-      if (symbol_get_demangled_name (gsymbol) != NULL)
-       return symbol_get_demangled_name (gsymbol);
-      else
-       return ada_decode_symbol (gsymbol);
+      dem_name = symbol_get_demangled_name (gsymbol);
+      if (dem_name == NULL)
+       dem_name = ada_decode_symbol (gsymbol);
       break;
     default:
       break;
     }
-  return NULL;
+  return dem_name;
 }
 
 /* Return the search name of a symbol---generally the demangled or