Use htab_up in breakpoint.c
authorTom Tromey <tom@tromey.com>
Thu, 17 Sep 2020 17:47:50 +0000 (11:47 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 17 Sep 2020 17:58:56 +0000 (11:58 -0600)
This changes breakpoint.c to use htab_up rather than an explicit
htab_delete.  This simplifies the code somewhat.

gdb/ChangeLog
2020-09-17  Tom Tromey  <tom@tromey.com>

* breakpoint.c (ambiguous_names_p): Use htab_up.

gdb/ChangeLog
gdb/breakpoint.c

index e9b7b7d596087b2406152fc4f2dabb2083d8da97..cd0a18029ec924095f39e731facb795b7cee9835 100644 (file)
@@ -1,3 +1,7 @@
+2020-09-17  Tom Tromey  <tom@tromey.com>
+
+       * breakpoint.c (ambiguous_names_p): Use htab_up.
+
 2020-09-17  Tom Tromey  <tom@tromey.com>
 
        * auto-load.c (struct auto_load_pspace_info)
index 1876af955b49a7c455ff30b912466599d0462ac8..e0712b2ea9d2da9378e77f7f0720072c82031e86 100644 (file)
@@ -13246,8 +13246,8 @@ static int
 ambiguous_names_p (struct bp_location *loc)
 {
   struct bp_location *l;
-  htab_t htab = htab_create_alloc (13, htab_hash_string, streq_hash, NULL,
-                                  xcalloc, xfree);
+  htab_up htab (htab_create_alloc (13, htab_hash_string, streq_hash, NULL,
+                                  xcalloc, xfree));
 
   for (l = loc; l != NULL; l = l->next)
     {
@@ -13258,19 +13258,15 @@ ambiguous_names_p (struct bp_location *loc)
       if (name == NULL)
        continue;
 
-      slot = (const char **) htab_find_slot (htab, (const void *) name,
+      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)
-       {
-         htab_delete (htab);
-         return 1;
-       }
+       return 1;
       *slot = name;
     }
 
-  htab_delete (htab);
   return 0;
 }
 
This page took 0.037077 seconds and 4 git commands to generate.