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.
This commit is contained in:
Tom Tromey
2019-03-02 12:18:05 -07:00
parent d6797f465c
commit db92718b54
4 changed files with 12 additions and 6 deletions

View 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. */