C++ improvements
[deliverable/binutils-gdb.git] / gdb / symtab.c
index 41c23aa6b1438b7b711afe55aea2d4d95c72dc9a..5f0e84aeefe2c6288f8af3ad6c83d011be36ead1 100644 (file)
@@ -954,7 +954,7 @@ lookup_symbol (name, block, namespace, is_a_field_of_this, symtab)
     *symtab = NULL;
   return 0;
 }
-
+                                                               
 /* Look, in partial_symtab PST, for symbol NAME.  Check the global
    symbols if GLOBAL, the static symbols if not */
 
@@ -965,20 +965,20 @@ lookup_partial_symbol (pst, name, global, namespace)
      int global;
      namespace_enum namespace;
 {
+  struct partial_symbol *temp;
   struct partial_symbol **start, **psym;
   struct partial_symbol **top, **bottom, **center;
   int length = (global ? pst->n_global_syms : pst->n_static_syms);
   int do_linear_search = 1;
-
+  
   if (length == 0)
     {
       return (NULL);
     }
-
   start = (global ?
           pst->objfile->global_psymbols.list + pst->globals_offset :
           pst->objfile->static_psymbols.list + pst->statics_offset);
-
+  
   if (global)                  /* This means we can use a binary search. */
     {
       do_linear_search = 0;
@@ -996,9 +996,7 @@ lookup_partial_symbol (pst, name, global, namespace)
          if (!(center < top))
            abort ();
          if (!do_linear_search
-             && (SYMBOL_LANGUAGE (*center) == language_cplus
-                 || SYMBOL_LANGUAGE (*center) == language_java
-             ))
+             && (SYMBOL_LANGUAGE (*center) == language_java))
            {
              do_linear_search = 1;
            }
@@ -1013,11 +1011,15 @@ lookup_partial_symbol (pst, name, global, namespace)
        }
       if (!(top == bottom))
        abort ();
-      while (STREQ (SYMBOL_NAME (*top), name))
+
+      /* djb - 2000-06-03 - Use SYMBOL_MATCHES_NAME, not a strcmp, so
+        we don't have to force a linear search on C++. Probably holds true
+        for JAVA as well, no way to check.*/
+      while (SYMBOL_MATCHES_NAME (*top,name))
        {
          if (SYMBOL_NAMESPACE (*top) == namespace)
            {
-             return (*top);
+                 return (*top);
            }
          top++;
        }
@@ -1027,7 +1029,7 @@ lookup_partial_symbol (pst, name, global, namespace)
      we should also do a linear search. */
 
   if (do_linear_search)
-    {
+    {                  
       for (psym = start; psym < start + length; psym++)
        {
          if (namespace == SYMBOL_NAMESPACE (*psym))
@@ -4018,6 +4020,7 @@ functions_info (regexp, from_tty)
   symtab_symbol_info (regexp, FUNCTIONS_NAMESPACE, from_tty);
 }
 
+
 static void
 types_info (regexp, from_tty)
      char *regexp;
@@ -4664,6 +4667,7 @@ _initialize_symtab ()
   add_info ("functions", functions_info,
            "All function names, or those matching REGEXP.");
 
+  
   /* FIXME:  This command has at least the following problems:
      1.  It prints builtin types (in a very strange and confusing fashion).
      2.  It doesn't print right, e.g. with
This page took 0.024839 seconds and 4 git commands to generate.