[07/19] Convert breakpoint.c to new hash table
Commit Message
This converts breakpoint.c to use the new hash table.
---
gdb/breakpoint.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
@@ -20,7 +20,6 @@
#include "defs.h"
#include "arch-utils.h"
#include <ctype.h>
-#include "hashtab.h"
#include "symtab.h"
#include "frame.h"
#include "breakpoint.h"
@@ -81,6 +80,7 @@
#include "progspace-and-thread.h"
#include "gdbsupport/array-view.h"
#include "gdbsupport/gdb_optional.h"
+#include "gdbsupport/hash-table.h"
/* Prototypes for local functions. */
@@ -12489,25 +12489,21 @@ static bool
ambiguous_names_p (struct bp_location *loc)
{
struct bp_location *l;
- htab_up htab (htab_create_alloc (13, htab_hash_string, htab_eq_string, NULL,
- xcalloc, xfree));
+
+ using traits = gdb::libiberty_traits<htab_hash_string, htab_eq_string,
+ const char *>;
+ gdb::traited_hash_table<traits> htab;
for (l = loc; l != NULL; l = l->next)
{
- const char **slot;
const char *name = l->function_name.get ();
/* Allow for some names to be NULL, ignore them. */
if (name == NULL)
continue;
- slot = (const char **) htab_find_slot (htab.get (), (const void *) name,
- INSERT);
- /* NOTE: We can assume slot != NULL here because xcalloc never
- returns NULL. */
- if (*slot != NULL)
+ if (!htab.insert (name).second)
return true;
- *slot = name;
}
return false;