]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libiberty: fix type in allocation
authorMartin Liska <mliska@suse.cz>
Tue, 10 May 2022 15:31:24 +0000 (17:31 +0200)
committerMartin Liska <mliska@suse.cz>
Tue, 10 May 2022 15:32:44 +0000 (17:32 +0200)
The allocation function alloc_f is called for nsize
items where each is of type void *.

libiberty/ChangeLog:

* hashtab.c (htab_empty): Use void * type instead of void **.
(htab_expand): Likewise.

Co-Authored-By: Alan Modra <amodra@gmail.com>
libiberty/hashtab.c

index f7621cd47e554a71175db70441d45f9d692ee5b5..470d3e66c32bf366f1c847126306150309c86dbc 100644 (file)
@@ -458,9 +458,9 @@ htab_empty (htab_t htab)
        (*htab->free_with_arg_f) (htab->alloc_arg, htab->entries);
       if (htab->alloc_with_arg_f != NULL)
        htab->entries = (void **) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize,
-                                                          sizeof (void **));
+                                                            sizeof (void *));
       else
-       htab->entries = (void **) (*htab->alloc_f) (nsize, sizeof (void **));
+       htab->entries = (void **) (*htab->alloc_f) (nsize, sizeof (void *));
      htab->size = nsize;
      htab->size_prime_index = nindex;
     }
@@ -544,9 +544,9 @@ htab_expand (htab_t htab)
 
   if (htab->alloc_with_arg_f != NULL)
     nentries = (void **) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize,
-                                                 sizeof (void **));
+                                                   sizeof (void *));
   else
-    nentries = (void **) (*htab->alloc_f) (nsize, sizeof (void **));
+    nentries = (void **) (*htab->alloc_f) (nsize, sizeof (void *));
   if (nentries == NULL)
     return 0;
   htab->entries = nentries;