+2020-09-17 Tom Tromey <tom@tromey.com>
+
+ * linespec.c (class decode_compound_collector)
+ <~decode_compound_collector>: Remove.
+ <m_unique_syms>: Now htab_up.
+ (decode_compound_collector::operator ()): Update.
+ (class symtab_collector) <~symtab_collector>: Remove.
+ <m_symtab_table>: Now htab_up.
+ (symtab_collector::operator ()): Update.
+
2020-09-17 Tom Tromey <tom@tromey.com>
* filename-seen-cache.c (filename_seen_cache::filename_seen_cache)
{
public:
decode_compound_collector ()
+ : m_unique_syms (htab_create_alloc (1, htab_hash_pointer,
+ htab_eq_pointer, NULL,
+ xcalloc, xfree))
{
- m_unique_syms = htab_create_alloc (1, htab_hash_pointer,
- htab_eq_pointer, NULL,
- xcalloc, xfree);
- }
-
- ~decode_compound_collector ()
- {
- if (m_unique_syms != NULL)
- htab_delete (m_unique_syms);
}
/* Return all symbols collected. */
private:
/* A hash table of all symbols we found. We use this to avoid
adding any symbol more than once. */
- htab_t m_unique_syms;
+ htab_up m_unique_syms;
/* The result vector. */
std::vector<block_symbol> m_symbols;
&& t->code () != TYPE_CODE_NAMESPACE)
return true; /* Continue iterating. */
- slot = htab_find_slot (m_unique_syms, sym, INSERT);
+ slot = htab_find_slot (m_unique_syms.get (), sym, INSERT);
if (!*slot)
{
*slot = sym;
{
public:
symtab_collector ()
+ : m_symtab_table (htab_create (1, htab_hash_pointer, htab_eq_pointer,
+ NULL))
{
- m_symtab_table = htab_create (1, htab_hash_pointer, htab_eq_pointer,
- NULL);
- }
-
- ~symtab_collector ()
- {
- if (m_symtab_table != NULL)
- htab_delete (m_symtab_table);
}
/* Callable as a symbol_found_callback_ftype callback. */
std::vector<symtab *> m_symtabs;
/* This is used to ensure the symtabs are unique. */
- htab_t m_symtab_table;
+ htab_up m_symtab_table;
};
bool
{
void **slot;
- slot = htab_find_slot (m_symtab_table, symtab, INSERT);
+ slot = htab_find_slot (m_symtab_table.get (), symtab, INSERT);
if (!*slot)
{
*slot = symtab;