diff options
author | Tom Tromey <tom@tromey.com> | 2020-09-17 11:47:50 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-09-17 11:58:56 -0600 |
commit | c1fb98360cf47485a5f943b657fe8d56244da7e7 (patch) | |
tree | 6ec446cfe795de054540c873347afaa793b3d37a | |
parent | 88f07206fa577f80e8f6cfed7b2183dc3b4e9f39 (diff) | |
download | gdb-c1fb98360cf47485a5f943b657fe8d56244da7e7.zip gdb-c1fb98360cf47485a5f943b657fe8d56244da7e7.tar.gz gdb-c1fb98360cf47485a5f943b657fe8d56244da7e7.tar.bz2 |
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 <tom@tromey.com>
* breakpoint.c (ambiguous_names_p): Use htab_up.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/breakpoint.c | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e9b7b7d..cd0a180 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 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) <~auto_load_pspace_info, auto_load_pspace_info>: Remove. <loaded_script_files, loaded_script_texts>: Change type to 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; } |