I tried reading the documentation, which is awfully sparse, to see how to use the hash table and if it would be a good replacement for the current one in cyrus-imapd.
The destroy function in cyrus-imapd has both a destroy that
takes a cleanup function for values, and an interator:
I couldn't see how to do either with this library until reading the source code I see you can set a mem_free at creation instead.
The documentation didn't really describe that, and the example is actively wrong.
I see from the code that there's a way to get the keys, from which you can do an external iterator. It's less efficient, but it works. You wouldn't know that from the documentation though, you have to read the source code.
Any chance you're going to submit a pull request to fix the documentation? I'd like to check this library out for use in a project, but I'm not sure I'd get so far as you have with regards to matching the documentation to the sources ..
The destroy function in cyrus-imapd has both a destroy that takes a cleanup function for values, and an interator:
https://github.com/brong/cyrus-imapd/blob/master/lib/hash.c
I couldn't see how to do either with this library until reading the source code I see you can set a mem_free at creation instead.
The documentation didn't really describe that, and the example is actively wrong.
I see from the code that there's a way to get the keys, from which you can do an external iterator. It's less efficient, but it works. You wouldn't know that from the documentation though, you have to read the source code.