[gdb/symtab] Fix name lookup in dw2_map_matching_symbols
[deliverable/binutils-gdb.git] / gdb / dwarf2 / abbrev.c
index b85018060fa30b16b338b72ac99e75e6a9b7a495..1552594efb5cd5a3e524141f5349ec3b88ce446b 100644 (file)
@@ -36,6 +36,8 @@ static hashval_t
 hash_abbrev (const void *item)
 {
   const struct abbrev_info *info = (const struct abbrev_info *) item;
+  /* Warning: if you change this next line, you must also update the
+     other code in this class using the _with_hash functions.  */
   return info->number;
 }
 
@@ -79,25 +81,13 @@ abbrev_table::alloc_abbrev ()
 /* Add an abbreviation to the table.  */
 
 void
-abbrev_table::add_abbrev (unsigned int abbrev_number,
-                         struct abbrev_info *abbrev)
+abbrev_table::add_abbrev (struct abbrev_info *abbrev)
 {
-  void **slot = htab_find_slot (m_abbrevs.get (), abbrev, INSERT);
+  void **slot = htab_find_slot_with_hash (m_abbrevs.get (), abbrev,
+                                         abbrev->number, INSERT);
   *slot = abbrev;
 }
 
-/* Look up an abbrev in the table.
-   Returns NULL if the abbrev is not found.  */
-
-struct abbrev_info *
-abbrev_table::lookup_abbrev (unsigned int abbrev_number)
-{
-  struct abbrev_info search;
-  search.number = abbrev_number;
-
-  return (struct abbrev_info *) htab_find (m_abbrevs.get (), &search);
-}
-
 /* Read in an abbrev table.  */
 
 abbrev_table_up
@@ -172,7 +162,7 @@ abbrev_table::read (struct objfile *objfile,
        memcpy (cur_abbrev->attrs, cur_attrs.data (),
                cur_abbrev->num_attrs * sizeof (struct attr_abbrev));
 
-      abbrev_table->add_abbrev (abbrev_number, cur_abbrev);
+      abbrev_table->add_abbrev (cur_abbrev);
 
       /* Get next abbreviation.
          Under Irix6 the abbreviations for a compilation unit are not
This page took 0.024247 seconds and 4 git commands to generate.