Use htab_eq_string in libctf
authorAlan Modra <amodra@gmail.com>
Sun, 9 May 2021 02:58:32 +0000 (12:28 +0930)
committerAlan Modra <amodra@gmail.com>
Sun, 9 May 2021 02:58:32 +0000 (12:28 +0930)
* ctf-impl.h (ctf_dynset_eq_string): Don't declare.
* ctf-hash.c (ctf_dynset_eq_string): Delete function.
* ctf-dedup.c (make_set_element): Use htab_eq_string.
(ctf_dedup_atoms_init, ADD_CITER, ctf_dedup_init): Likewise.
(ctf_dedup_conflictify_unshared): Likewise.
(ctf_dedup_walk_output_mapping): Likewise.

libctf/ChangeLog
libctf/ctf-dedup.c
libctf/ctf-hash.c
libctf/ctf-impl.h

index 979c6c55cb2f5fba706d9c18806c7ca359ff70a2..5d2e1984605d03ea759b1c114bf8e4964d6480ba 100644 (file)
@@ -1,3 +1,12 @@
+2021-05-09  Alan Modra  <amodra@gmail.com>
+
+       * ctf-impl.h (ctf_dynset_eq_string): Don't declare.
+       * ctf-hash.c (ctf_dynset_eq_string): Delete function.
+       * ctf-dedup.c (make_set_element): Use htab_eq_string.
+       (ctf_dedup_atoms_init, ADD_CITER, ctf_dedup_init): Likewise.
+       (ctf_dedup_conflictify_unshared): Likewise.
+       (ctf_dedup_walk_output_mapping): Likewise.
+
 2021-05-06  Nick Alcock  <nick.alcock@oracle.com>
 
        * testsuite/lib/ctf-lib.exp: Use -gctf, not -gt.
index 649a76a91b62a55d5ac86214fd5651f3664bfea1..6a76fc81b05d26e6b5eed74aa5421004c95bba97 100644 (file)
@@ -352,7 +352,7 @@ make_set_element (ctf_dynhash_t *set, const void *key)
   if ((element = ctf_dynhash_lookup (set, key)) == NULL)
     {
       if ((element = ctf_dynset_create (htab_hash_string,
-                                       ctf_dynset_eq_string,
+                                       htab_eq_string,
                                        NULL)) == NULL)
        return NULL;
 
@@ -376,7 +376,7 @@ ctf_dedup_atoms_init (ctf_dict_t *fp)
   if (!fp->ctf_dedup_atoms_alloc)
     {
       if ((fp->ctf_dedup_atoms_alloc
-          = ctf_dynset_create (htab_hash_string, ctf_dynset_eq_string,
+          = ctf_dynset_create (htab_hash_string, htab_eq_string,
                                free)) == NULL)
        return ctf_set_errno (fp, ENOMEM);
     }
@@ -584,8 +584,8 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
       whaterr = N_("error updating citers");                           \
       if (!citers)                                                     \
        if ((citers = ctf_dynset_create (htab_hash_string,              \
-                                         ctf_dynset_eq_string,         \
-                                         NULL)) == NULL)               \
+                                        htab_eq_string,                \
+                                        NULL)) == NULL)                \
          goto oom;                                                     \
       if (ctf_dynset_cinsert (citers, hval) < 0)                       \
        goto oom;                                                       \
@@ -1656,7 +1656,7 @@ ctf_dedup_init (ctf_dict_t *fp)
 
   if ((d->cd_conflicting_types
        = ctf_dynset_create (htab_hash_string,
-                           ctf_dynset_eq_string, NULL)) == NULL)
+                           htab_eq_string, NULL)) == NULL)
     goto oom;
 
   return 0;
@@ -1814,7 +1814,7 @@ ctf_dedup_conflictify_unshared (ctf_dict_t *output, ctf_dict_t **inputs)
   const void *k;
   ctf_dynset_t *to_mark = NULL;
 
-  if ((to_mark = ctf_dynset_create (htab_hash_string, ctf_dynset_eq_string,
+  if ((to_mark = ctf_dynset_create (htab_hash_string, htab_eq_string,
                                    NULL)) == NULL)
     goto err_no;
 
@@ -2351,7 +2351,7 @@ ctf_dedup_walk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
   void *k;
 
   if ((already_visited = ctf_dynset_create (htab_hash_string,
-                                           ctf_dynset_eq_string,
+                                           htab_eq_string,
                                            NULL)) == NULL)
     return ctf_set_errno (output, ENOMEM);
 
index 426bd625ffb44fb3bb59c69d0a8c8dcae5d61084..73fca6fe5d203fb5d8e3570920f68dc7bc0a7352 100644 (file)
@@ -140,15 +140,6 @@ ctf_hash_eq_type_id_key (const void *a, const void *b)
     && (key_a->ctii_type == key_b->ctii_type);
 }
 
-/* Hash and eq functions for the dynset.  Most of these can just use the
-   underlying hashtab functions directly.   */
-
-int
-ctf_dynset_eq_string (const void *a, const void *b)
-{
-  return !strcmp((const char *) a, (const char *) b);
-}
-
 /* The dynhash, used for hashes whose size is not known at creation time. */
 
 /* Free a single ctf_helem with arbitrary key/value functions.  */
index 342d2ff23e2d038c929311121aab67956d957bc9..80c47239e262775fc374b294652541c7aa9c255c 100644 (file)
@@ -617,8 +617,6 @@ extern int ctf_hash_eq_string (const void *, const void *);
 extern int ctf_hash_eq_type_key (const void *, const void *);
 extern int ctf_hash_eq_type_id_key (const void *, const void *);
 
-extern int ctf_dynset_eq_string (const void *, const void *);
-
 typedef void (*ctf_hash_free_fun) (void *);
 
 typedef void (*ctf_hash_iter_f) (void *key, void *value, void *arg);
This page took 0.028904 seconds and 4 git commands to generate.