Use htab_up for demangled hash
authorTom Tromey <tom@tromey.com>
Sat, 2 Mar 2019 19:18:05 +0000 (12:18 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 15 Mar 2019 22:02:09 +0000 (16:02 -0600)
This changes objfile_per_bfd_storage::demangled_names_hash to be an
htab_up.  This lets us remove some manual management code from the
objfile_per_bfd_storage destructor.

gdb/ChangeLog
2019-03-15  Tom Tromey  <tom@tromey.com>

* symtab.c (create_demangled_names_hash): Update.
(symbol_set_names): Update.
* objfiles.h (struct objfile_per_bfd_storage)
<demangled_names_hash>: Now an htab_up.
* objfiles.c (objfile_per_bfd_storage): Simplify.

gdb/ChangeLog
gdb/objfiles.c
gdb/objfiles.h
gdb/symtab.c

index 13c207d195cad985b8ead9f78751f402790eb3ad..3a9532047a027a54ba946d8d486c4b26bbed001c 100644 (file)
@@ -1,3 +1,11 @@
+2019-03-15  Tom Tromey  <tom@tromey.com>
+
+       * symtab.c (create_demangled_names_hash): Update.
+       (symbol_set_names): Update.
+       * objfiles.h (struct objfile_per_bfd_storage)
+       <demangled_names_hash>: Now an htab_up.
+       * objfiles.c (objfile_per_bfd_storage): Simplify.
+
 2019-03-15  Tom Tromey  <tom@tromey.com>
 
        * objfiles.h (struct objfile_per_bfd_storage): Declare
index ff8b6fc72cffee439719797edb5116b6b6690ab9..7d36a2a7114d74ecb280e3d3f8dc69d022dd8b1a 100644 (file)
@@ -119,8 +119,6 @@ static const struct bfd_data *objfiles_bfd_data;
 
 objfile_per_bfd_storage::~objfile_per_bfd_storage ()
 {
-  if (demangled_names_hash)
-    htab_delete (demangled_names_hash);
 }
 
 /* Create the per-BFD storage object for OBJFILE.  If ABFD is not
index 6f8eb7f9ef891af11ecf77a9df3b2e803c32a85c..1fa6f3c40ab23228d3cad22d1fb90937f4cc00b4 100644 (file)
@@ -262,7 +262,7 @@ struct objfile_per_bfd_storage
      name, and the second is the demangled name or just a zero byte
      if the name doesn't demangle.  */
 
-  htab *demangled_names_hash = NULL;
+  htab_up demangled_names_hash;
 
   /* The per-objfile information about the entry point, the scope (file/func)
      containing the entry point, and the scope of the user's main() func.  */
index 005ea23da8d19f397347e5ad245020fe81f9dbf3..449bc4cd2b329d0d3c310e9a945f4f2328d36aa8 100644 (file)
@@ -740,9 +740,9 @@ create_demangled_names_hash (struct objfile_per_bfd_storage *per_bfd)
      Choosing a much larger table size wastes memory, and saves only about
      1% in symbol reading.  */
 
-  per_bfd->demangled_names_hash = htab_create_alloc
+  per_bfd->demangled_names_hash.reset (htab_create_alloc
     (256, hash_demangled_name_entry, eq_demangled_name_entry,
-     NULL, xcalloc, xfree);
+     NULL, xcalloc, xfree));
 }
 
 /* Try to determine the demangled name for a symbol, based on the
@@ -848,7 +848,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
 
   entry.mangled = linkage_name_copy;
   slot = ((struct demangled_name_entry **)
-         htab_find_slot (per_bfd->demangled_names_hash,
+         htab_find_slot (per_bfd->demangled_names_hash.get (),
                          &entry, INSERT));
 
   /* If this name is not in the hash table, add it.  */
This page took 0.032274 seconds and 4 git commands to generate.