aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-hash.c
AgeCommit message (Collapse)AuthorFilesLines
2019-07-01libctf: add hash traversal helpersNick Alcock1-0/+49
There are two, ctf_dynhash_iter and ctf_dynhash_iter_remove: the latter lets you return a nonzero value to remove the element being iterated over. Used in the next commit. libctf/ * ctf-impl.h (ctf_hash_iter_f): New. (ctf_dynhash_iter): New declaration. (ctf_dynhash_iter_remove): New declaration. * ctf-hash.c (ctf_dynhash_iter): Define. (ctf_dynhash_iter_remove): Likewise. (ctf_hashtab_traverse): New. (ctf_hashtab_traverse_remove): Likewise. (struct ctf_traverse_cb_arg): Likewise. (struct ctf_traverse_remove_cb_arg): Likewise.
2019-07-01libctf: fix hash removalNick Alcock1-1/+2
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.
2019-05-28libctf: hashingNick Alcock1-0/+277
libctf maintains two distinct hash ADTs, one (ctf_dynhash) for wrapping dynamically-generated unknown-sized hashes during CTF file construction, one (ctf_hash) for wrapping unchanging hashes whose size is known at creation time for reading CTF files that were previously created. In the binutils implementation, these are both fairly thin wrappers around libiberty hashtab. Unusually, this code is not kept synchronized with libdtrace-ctf, due to its dependence on libiberty hashtab. libctf/ * ctf-hash.c: New file. * ctf-impl.h: New declarations.