On Tue, May 10, 2022 at 10:56:22AM +0200, Martin Liška wrote:

> diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c

> @@ -457,15 +457,15 @@ htab_empty (htab_t htab)
>        else if (htab->free_with_arg_f != NULL)
>       (*htab->free_with_arg_f) (htab->alloc_arg, htab->entries);
>        if (htab->alloc_with_arg_f != NULL)
> -     htab->entries = (PTR *) (*htab->alloc_with_arg_f) (htab->alloc_arg, 
> nsize,
> -                                                        sizeof (PTR *));
> +     htab->entries = (void **) (*htab->alloc_with_arg_f) (htab->alloc_arg, 
> nsize,
> +                                                        sizeof (void **));

Here, and below, the code should really be using "sizeof (void *)".
You may as well fix that nit while you're at it.  Also, indentation
looks wrong.

>        else
> -     htab->entries = (PTR *) (*htab->alloc_f) (nsize, sizeof (PTR *));
> +     htab->entries = (void **) (*htab->alloc_f) (nsize, sizeof (void **));
>       htab->size = nsize;
>       htab->size_prime_index = nindex;
>      }
>    else
> -    memset (entries, 0, size * sizeof (PTR));
> +    memset (entries, 0, size * sizeof (void *));
>    htab->n_deleted = 0;
>    htab->n_elements = 0;
>  }

> @@ -543,10 +543,10 @@ htab_expand (htab_t htab)
>      }
>  
>    if (htab->alloc_with_arg_f != NULL)
> -    nentries = (PTR *) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize,
> -                                               sizeof (PTR *));
> +    nentries = (void **) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize,
> +                                               sizeof (void **));
>    else
> -    nentries = (PTR *) (*htab->alloc_f) (nsize, sizeof (PTR *));
> +    nentries = (void **) (*htab->alloc_f) (nsize, sizeof (void **));
>    if (nentries == NULL)
>      return 0;
>    htab->entries = nentries;

Here too.

-- 
Alan Modra
Australia Development Lab, IBM

Reply via email to