]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Convert breakpoint.c to new hash table
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 4 Nov 2024 18:27:41 +0000 (13:27 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 26 Nov 2024 03:07:04 +0000 (22:07 -0500)
This converts breakpoint.c to use the new hash table.

Change-Id: I6d997a6242969586a7f8f9eb22cc8dd8d3ac97ff
Co-Authored-By: Tom Tromey <tom@tromey.com>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/breakpoint.c

index 0ad169a98b09cbfa897a1c37fdfbe60d5a9d6506..0a889a04e81ae7b3592434188a162c6db2e99e64 100644 (file)
@@ -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"
@@ -12736,25 +12736,18 @@ 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)
+      if (!htab.insert (name).second)
        return true;
-      *slot = name;
     }
 
   return false;