summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-08-18 10:51:28 +0200
committerAlan Modra <amodra@gmail.com>2020-08-20 10:56:07 +0930
commit494b2fc8078502f84a2ff2a3402a5989b221526d (patch)
treef4c57d1d7df46ef3dddb70339710f6ebe0bb40a8
parentf7a5981beb423a0bc03633ac8156d33d83ef41d6 (diff)
downloadbinutils-gdb-494b2fc8078502f84a2ff2a3402a5989b221526d.tar.gz
Port dw2gencfi.c to str_htab.
* dw2gencfi.c (dwcfi_hash_insert): Use htab_t and str_hash_* functions. (dwcfi_hash_find): Likewise. (dwcfi_hash_find_or_make): Likewise.
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/dw2gencfi.c18
2 files changed, 11 insertions, 14 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 417ec653c3f..77aa83fdbcf 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,12 @@
2020-08-20 Martin Liska <mliska@suse.cz>
+ * dw2gencfi.c (dwcfi_hash_insert): Use htab_t and str_hash_*
+ functions.
+ (dwcfi_hash_find): Likewise.
+ (dwcfi_hash_find_or_make): Likewise.
+
+2020-08-20 Martin Liska <mliska@suse.cz>
+
* ecoff.c (INIT_VARRAY): Use htab_t.
(add_string): Likewise.
(ecoff_read_begin_hook): Use new str_htab_create.
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index a4fe8ac9196..964a7792270 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -115,7 +115,7 @@ static bfd_boolean compact_eh;
#define compact_eh 0
#endif
-static struct hash_control *dwcfi_hash;
+static htab_t dwcfi_hash;
/* Emit a single byte into the current segment. */
@@ -325,20 +325,10 @@ make_debug_seg (segT cseg, char *name, int sflags)
return r;
}
-static void
-dwcfi_hash_insert (const char *name, struct dwcfi_seg_list *item)
-{
- const char *error_string;
-
- if ((error_string = hash_jam (dwcfi_hash, name, (char *) item)))
- as_fatal (_("Inserting \"%s\" into structure table failed: %s"),
- name, error_string);
-}
-
static struct dwcfi_seg_list *
dwcfi_hash_find (char *name)
{
- return (struct dwcfi_seg_list *) hash_find (dwcfi_hash, name);
+ return (struct dwcfi_seg_list *) str_hash_find (dwcfi_hash, name);
}
static struct dwcfi_seg_list *
@@ -349,7 +339,7 @@ dwcfi_hash_find_or_make (segT cseg, const char *base_name, int flags)
/* Initialize dwcfi_hash once. */
if (!dwcfi_hash)
- dwcfi_hash = hash_new ();
+ dwcfi_hash = str_htab_create ();
name = get_debugseg_name (cseg, base_name);
@@ -358,7 +348,7 @@ dwcfi_hash_find_or_make (segT cseg, const char *base_name, int flags)
{
item = alloc_debugseg_item (make_debug_seg (cseg, name, flags), 0, name);
- dwcfi_hash_insert (item->seg_name, item);
+ str_hash_insert (dwcfi_hash, item->seg_name, (char *) item);
}
else
free (name);