diff options
author | Alan Modra <amodra@gmail.com> | 2024-08-29 11:08:44 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-08-29 21:05:57 +0930 |
commit | 35e273526b7d4e345bb77a042af093508dad57f4 (patch) | |
tree | 4dad53d5bb5223e9550310aff275d41224b6b74e /libctf | |
parent | 8ee4561d38f2b35cc5068ad3b39f839c2847b5d4 (diff) | |
download | binutils-35e273526b7d4e345bb77a042af093508dad57f4.zip binutils-35e273526b7d4e345bb77a042af093508dad57f4.tar.gz binutils-35e273526b7d4e345bb77a042af093508dad57f4.tar.bz2 |
PR32093, -Walloc-size warning in ctf-hash.c
PR 32093
* ctf-hash.c (ctf_dynhash_create_sized, ctf_hashtab_insert): Avoid
-Walloc-size warning.
Diffstat (limited to 'libctf')
-rw-r--r-- | libctf/ctf-hash.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libctf/ctf-hash.c b/libctf/ctf-hash.c index cd74734..a451aa2 100644 --- a/libctf/ctf-hash.c +++ b/libctf/ctf-hash.c @@ -164,7 +164,10 @@ ctf_dynhash_create_sized (unsigned long nelems, ctf_hash_fun hash_fun, if (key_free || value_free) dynhash = malloc (sizeof (ctf_dynhash_t)); else - dynhash = malloc (offsetof (ctf_dynhash_t, key_free)); + { + void *p = malloc (offsetof (ctf_dynhash_t, key_free)); + dynhash = p; + } if (!dynhash) return NULL; @@ -225,7 +228,10 @@ ctf_hashtab_insert (struct htab *htab, void *key, void *value, if (key_free || value_free) *slot = malloc (sizeof (ctf_helem_t)); else - *slot = malloc (offsetof (ctf_helem_t, owner)); + { + void *p = malloc (offsetof (ctf_helem_t, owner)); + *slot = p; + } if (!*slot) return NULL; (*slot)->key = key; |