aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-08-19 15:03:50 +0000
committerSimon Marchi <simon.marchi@efficios.com>2024-08-23 14:37:54 -0400
commit7f6f1e7f001585390cd9d1906646732c3a7d99b6 (patch)
treeb5df2f1166bcb435ced65195c4e203fde0750c02
parentc4f180d72d20459c28ed0926db445bc8704527f8 (diff)
downloadgdb-7f6f1e7f001585390cd9d1906646732c3a7d99b6.zip
gdb-7f6f1e7f001585390cd9d1906646732c3a7d99b6.tar.gz
gdb-7f6f1e7f001585390cd9d1906646732c3a7d99b6.tar.bz2
Convert breakpoint.c to new hash table
This converts breakpoint.c to use the new hash table. Change-Id: I6d997a6242969586a7f8f9eb22cc8dd8d3ac97ff Co-Authored-By: Tom Tromey <tom@tromey.com>
-rw-r--r--gdb/breakpoint.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 17bd627..e04aec8 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -21,7 +21,7 @@
#include <ctype.h>
#include "event-top.h"
#include "exceptions.h"
-#include "hashtab.h"
+#include "gdbsupport/unordered_set.h"
#include "symtab.h"
#include "frame.h"
#include "breakpoint.h"
@@ -12749,25 +12749,20 @@ all_locations_are_pending (struct breakpoint *b, struct program_space *pspace)
static bool
ambiguous_names_p (const bp_location_range &locs)
{
- htab_up htab (htab_create_alloc (13, htab_hash_string, htab_eq_string, NULL,
- xcalloc, xfree));
+ gdb::unordered_set<std::string_view> htab;
for (const bp_location &l : locs)
{
- 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)
+ bool inserted = htab.insert (name).second;
+
+ if (!inserted)
return true;
- *slot = name;
}
return false;