summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-03-02 12:18:05 -0700
committerTom Tromey <tom@tromey.com>2019-03-15 16:02:09 -0600
commitdb92718b541158d4782dbc9f48401c20f2bbad6d (patch)
tree07e8ecdc56396760bd73fe7bef776d7c51146665 /gdb
parentd6797f465c3f67b41a0db38870bbd33384b6551f (diff)
downloadbinutils-gdb-db92718b541158d4782dbc9f48401c20f2bbad6d.tar.gz
Use htab_up for demangled hash
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/objfiles.c2
-rw-r--r--gdb/objfiles.h2
-rw-r--r--gdb/symtab.c6
4 files changed, 12 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 13c207d195c..3a9532047a0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
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
destructor.
* objfiles.c (objfile_per_bfd_storage::~objfile_per_bfd_storage):
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index ff8b6fc72cf..7d36a2a7114 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -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
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 6f8eb7f9ef8..1fa6f3c40ab 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -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. */
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 005ea23da8d..449bc4cd2b3 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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. */