+2021-05-26 Tom Tromey <tom@tromey.com>
+
+ * dwarf2/read.c (allocate_type_unit_groups_table)
+ (handle_DW_AT_stmt_list, allocate_dwo_file_hash_table): Use
+ htab_delete_entry.
+ (free_line_header_voidp): Remove.
+ * completer.c
+ (completion_tracker::completion_hash_entry::deleter): Remove.
+ (completion_tracker::discard_completions): Use htab_delete_entry.
+ * utils.h (htab_delete_entry): New template function.
+
2021-05-24 Hannes Domani <ssbssa@yahoo.de>
* python/py-tui.c (tui_py_window::refresh_window):
return htab_hash_string (m_name.get ());
}
- /* A static function that can be passed to the htab hash system to be
- used as a callback that deletes an item from the hash. */
- static void deleter (void *arg)
- {
- completion_hash_entry *entry = (completion_hash_entry *) arg;
- delete entry;
- }
-
private:
/* The symbol name stored in this hash entry. */
return entry->hash_name ();
};
- m_entries_hash.reset (htab_create_alloc (INITIAL_COMPLETION_HTAB_SIZE,
- entry_hash_func, entry_eq_func,
- completion_hash_entry::deleter,
- xcalloc, xfree));
+ m_entries_hash.reset
+ (htab_create_alloc (INITIAL_COMPLETION_HTAB_SIZE,
+ entry_hash_func, entry_eq_func,
+ htab_delete_entry<completion_hash_entry>,
+ xcalloc, xfree));
}
/* See completer.h. */
static void process_cu_includes (dwarf2_per_objfile *per_objfile);
static void check_producer (struct dwarf2_cu *cu);
-
-static void free_line_header_voidp (void *arg);
\f
/* Various complaints about symbol reading that don't abort the process. */
return htab_up (htab_create_alloc (3,
hash_type_unit_group,
eq_type_unit_group,
- [] (void *arg)
- {
- type_unit_group *grp
- = (type_unit_group *) arg;
- delete grp;
- },
+ htab_delete_entry<type_unit_group>,
xcalloc, xfree));
}
per_objfile->line_header_hash
.reset (htab_create_alloc (127, line_header_hash_voidp,
line_header_eq_voidp,
- free_line_header_voidp,
+ htab_delete_entry<line_header>,
xcalloc, xfree));
}
static htab_up
allocate_dwo_file_hash_table ()
{
- auto delete_dwo_file = [] (void *item)
- {
- struct dwo_file *dwo_file = (struct dwo_file *) item;
-
- delete dwo_file;
- };
-
return htab_up (htab_create_alloc (41,
hash_dwo_file,
eq_dwo_file,
- delete_dwo_file,
+ htab_delete_entry<dwo_file>,
xcalloc, xfree));
}
return follow_die_ref (die, spec_attr, spec_cu);
}
-/* Stub for free_line_header to match void * callback types. */
-
-static void
-free_line_header_voidp (void *arg)
-{
- struct line_header *lh = (struct line_header *) arg;
-
- delete lh;
-}
-
/* A convenience function to find the proper .debug_line section for a CU. */
static struct dwarf2_section_info *
/* A unique_ptr wrapper for htab_t. */
typedef std::unique_ptr<htab, htab_deleter> htab_up;
+/* A wrapper for 'delete' that can used as a hash table entry deletion
+ function. */
+template<typename T>
+void
+htab_delete_entry (void *ptr)
+{
+ delete (T *) ptr;
+}
+
extern void init_page_info (void);
/* Temporarily set BATCH_FLAG and the associated unlimited terminal size.