mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-15 05:37:47 +08:00
PR32093, -Walloc-size warning in ctf-hash.c
PR 32093 * ctf-hash.c (ctf_dynhash_create_sized, ctf_hashtab_insert): Avoid -Walloc-size warning.
This commit is contained in:
@@ -164,7 +164,10 @@ ctf_dynhash_create_sized (unsigned long nelems, ctf_hash_fun hash_fun,
|
|||||||
if (key_free || value_free)
|
if (key_free || value_free)
|
||||||
dynhash = malloc (sizeof (ctf_dynhash_t));
|
dynhash = malloc (sizeof (ctf_dynhash_t));
|
||||||
else
|
else
|
||||||
dynhash = malloc (offsetof (ctf_dynhash_t, key_free));
|
{
|
||||||
|
void *p = malloc (offsetof (ctf_dynhash_t, key_free));
|
||||||
|
dynhash = p;
|
||||||
|
}
|
||||||
if (!dynhash)
|
if (!dynhash)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -225,7 +228,10 @@ ctf_hashtab_insert (struct htab *htab, void *key, void *value,
|
|||||||
if (key_free || value_free)
|
if (key_free || value_free)
|
||||||
*slot = malloc (sizeof (ctf_helem_t));
|
*slot = malloc (sizeof (ctf_helem_t));
|
||||||
else
|
else
|
||||||
*slot = malloc (offsetof (ctf_helem_t, owner));
|
{
|
||||||
|
void *p = malloc (offsetof (ctf_helem_t, owner));
|
||||||
|
*slot = p;
|
||||||
|
}
|
||||||
if (!*slot)
|
if (!*slot)
|
||||||
return NULL;
|
return NULL;
|
||||||
(*slot)->key = key;
|
(*slot)->key = key;
|
||||||
|
|||||||
Reference in New Issue
Block a user