aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-04-28 18:44:48 -0600
committerTom Tromey <tom@tromey.com>2021-05-06 08:51:28 -0600
commit77380c6806515baf8a30412c29550c257b01133b (patch)
tree64da23212825d86de5c67fac7e7897a3f9fe1d77 /gcc
parente69ac0203725fb8da83a1cc88d32191b7a0b2c0c (diff)
downloadgcc-77380c6806515baf8a30412c29550c257b01133b.zip
gcc-77380c6806515baf8a30412c29550c257b01133b.tar.gz
gcc-77380c6806515baf8a30412c29550c257b01133b.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. gcc * gensupport.c (htab_eq_string): Remove.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gensupport.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index 0f19bd7..e1ca06d 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -2322,14 +2322,6 @@ gen_reader::handle_unknown_directive (file_location loc, const char *rtx_name)
process_rtx (x, loc);
}
-/* Comparison function for the mnemonic hash table. */
-
-static int
-htab_eq_string (const void *s1, const void *s2)
-{
- return strcmp ((const char*)s1, (const char*)s2) == 0;
-}
-
/* Add mnemonic STR with length LEN to the mnemonic hash table
MNEMONIC_HTAB. A trailing zero end character is appended to STR
and a permanent heap copy of STR is created. */