* [pushed] Remove streq_hash in favor of htab_eq_string
@ 2021-05-07 15:19 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2021-05-07 15:19 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Now that libiberty includes htab_eq_string, we can remove the
identical function from gdb.
gdb/ChangeLog
2021-05-07 Tom Tromey <tom@tromey.com>
* breakpoint.c (ambiguous_names_p): Use htab_eq_string.
* utils.c (streq_hash): Remove.
* utils.h (streq_hash): Don't declare.
* completer.c (completion_tracker::discard_completions): Update
comment.
* ada-lang.c (_initialize_ada_language): Use htab_eq_string.
---
gdb/ChangeLog | 9 +++++++++
gdb/ada-lang.c | 3 ++-
gdb/breakpoint.c | 2 +-
gdb/completer.c | 2 +-
gdb/utils.c | 8 --------
gdb/utils.h | 5 -----
6 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index e15e583adca..34b0e925685 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13490,7 +13490,8 @@ When enabled, the debugger will stop using the DW_AT_GNAT_descriptive_type\n\
DWARF attribute."),
NULL, NULL, &maint_set_ada_cmdlist, &maint_show_ada_cmdlist);
- decoded_names_store = htab_create_alloc (256, htab_hash_string, streq_hash,
+ decoded_names_store = htab_create_alloc (256, htab_hash_string,
+ htab_eq_string,
NULL, xcalloc, xfree);
/* The ada-lang observers. */
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 35a891bb4b9..38406b45856 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13471,7 +13471,7 @@ static int
ambiguous_names_p (struct bp_location *loc)
{
struct bp_location *l;
- htab_up htab (htab_create_alloc (13, htab_hash_string, streq_hash, NULL,
+ htab_up htab (htab_create_alloc (13, htab_hash_string, htab_eq_string, NULL,
xcalloc, xfree));
for (l = loc; l != NULL; l = l->next)
diff --git a/gdb/completer.c b/gdb/completer.c
index 2330ad435a8..80e8c7b743e 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1593,7 +1593,7 @@ completion_tracker::discard_completions ()
m_entries_hash.reset (nullptr);
/* A callback used by the hash table to compare new entries with existing
- entries. We can't use the standard streq_hash function here as the
+ entries. We can't use the standard htab_eq_string function here as the
key to our hash is just a single string, while the values we store in
the hash are a struct containing multiple strings. */
static auto entry_eq_func
diff --git a/gdb/utils.c b/gdb/utils.c
index b9f8997ec80..1f48a5a0bfe 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2818,14 +2818,6 @@ streq (const char *lhs, const char *rhs)
return !strcmp (lhs, rhs);
}
-/* See utils.h. */
-
-int
-streq_hash (const void *lhs, const void *rhs)
-{
- return streq ((const char *) lhs, (const char *) rhs);
-}
-
\f
/*
diff --git a/gdb/utils.h b/gdb/utils.h
index b91e0d1ea34..94d37c5a8b1 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -99,11 +99,6 @@ extern int strcmp_iw_ordered (const char *, const char *);
extern bool streq (const char *, const char *);
-/* A variant of streq that is suitable for use as an htab
- callback. */
-
-extern int streq_hash (const void *, const void *);
-
extern int subset_compare (const char *, const char *);
/* Compare C strings for std::sort. */
--
2.26.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-07 15:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 15:19 [pushed] Remove streq_hash in favor of htab_eq_string Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).