libctf: fix hash removal

We must call htab_remove_elt with an element (in this case, a mocked-up
one with only the key populated, since no reasonable hash function will
need the other fields), not with the key alone.

libctf/
	* ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element.
This commit is contained in:
Nick Alcock 2019-06-28 21:58:31 +01:00
parent c550e7ba93
commit 3e10cffc98
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2019-06-28 Nick Alcock <nick.alcock@oracle.com>
* ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element.
2019-06-28 Nick Alcock <nick.alcock@oracle.com>
* ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x.

View File

@ -176,7 +176,8 @@ ctf_dynhash_insert (ctf_dynhash_t *hp, void *key, void *value)
void
ctf_dynhash_remove (ctf_dynhash_t *hp, const void *key)
{
htab_remove_elt (hp->htab, (void *) key);
ctf_helem_t hep = { (void *) key, NULL, NULL, NULL };
htab_remove_elt (hp->htab, &hep);
}
void *