[2/2] Use htab_eq_string in objcopy

Message ID 20210508141950.808902-3-tom@tromey.com
State New
Headers show
Series
  • Two small patches to use htab_eq_string
Related show

Commit Message

Tom Tromey May 8, 2021, 2:19 p.m.
This changes objcopy to use htab_eq_string from libiberty, rather than
its own private version of this same function.

binutils/ChangeLog
2021-05-08  Tom Tromey  <tom@tromey.com>

	* objcopy.c (eq_string): remove.
	(create_symbol_htab): Use htab_eq_string.
---
 binutils/ChangeLog |  5 +++++
 binutils/objcopy.c | 11 ++---------
 2 files changed, 7 insertions(+), 9 deletions(-)

-- 
2.26.3

Comments

H.J. Lu via Binutils May 10, 2021, 12:51 p.m. | #1
Hi Tom,

> binutils/ChangeLog

> 2021-05-08  Tom Tromey  <tom@tromey.com>

> 

> 	* objcopy.c (eq_string): remove.

> 	(create_symbol_htab): Use htab_eq_string.


Approved - please apply.

Cheers
   Nick

Patch

diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 946802ebb78..a6c2e0dcc26 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1025,18 +1025,11 @@  create_symbol2redef_htab (void)
 			    xcalloc, free);
 }
 
-/* There is htab_hash_string but no htab_eq_string. Makes sense.  */
-
-static int
-eq_string (const void *s1, const void *s2)
-{
-  return strcmp ((const char *) s1, (const char *) s2) == 0;
-}
-
 static htab_t
 create_symbol_htab (void)
 {
-  return htab_create_alloc (16, htab_hash_string, eq_string, NULL, xcalloc, free);
+  return htab_create_alloc (16, htab_hash_string, htab_eq_string, NULL,
+			    xcalloc, free);
 }
 
 static void