From c1fb98360cf47485a5f943b657fe8d56244da7e7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 17 Sep 2020 11:47:50 -0600 Subject: Use htab_up in breakpoint.c 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 * breakpoint.c (ambiguous_names_p): Use htab_up. --- gdb/breakpoint.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'gdb/breakpoint.c') diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 1876af9..e0712b2 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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; } -- cgit v1.1