diff options
author | Tom Tromey <tom@tromey.com> | 2021-04-28 18:44:48 -0600 |
---|---|---|
committer | Richard Earnshaw <rearnsha@arm.com> | 2021-05-07 11:17:11 +0100 |
commit | c759c777c98fab555d28d133ef0793607f8c3afc (patch) | |
tree | 05b6f52b6a4ec335853f019ce9cd2a9e6330f034 /include | |
parent | 4cf88725da1cb503be04d3237354105ec170bc86 (diff) | |
download | gdb-c759c777c98fab555d28d133ef0793607f8c3afc.zip gdb-c759c777c98fab555d28d133ef0793607f8c3afc.tar.gz gdb-c759c777c98fab555d28d133ef0793607f8c3afc.tar.bz2 |
libiberty: add htab_eq_string
The libiberty hash table includes a helper function for strings, but
no equality function. Consequently, this equality function has been
reimplemented a number of times in both the gcc and binutils-gdb
source trees. This patch adds the function to the libiberty hash
table, as a step toward the goal of removing all the copies.
One change to gcc is included here. Normally I would have put this in
the next patch, but gensupport.c used the most natural name for its
reimplementation of this function, and this can't coexist with the
extern function in libiberty.
include
* hashtab.h (htab_eq_string): Declare.
libiberty
* hashtab.c (htab_eq_string): New function.
Diffstat (limited to 'include')
-rw-r--r-- | include/hashtab.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/hashtab.h b/include/hashtab.h index b3a6265..77c5eec 100644 --- a/include/hashtab.h +++ b/include/hashtab.h @@ -192,6 +192,9 @@ extern htab_eq htab_eq_pointer; /* A hash function for null-terminated strings. */ extern hashval_t htab_hash_string (const void *); +/* An equality function for null-terminated strings. */ +extern int htab_eq_string (const void *, const void *); + /* An iterative hash function for arbitrary data. */ extern hashval_t iterative_hash (const void *, size_t, hashval_t); /* Shorthand for hashing something with an intrinsic size. */ |