Jim Blandy <jimb@savonarola.red-bean.com> writes:
> To be fair --- apr hash tables *do* support empty keys. You just need
> to check for them every time you get/set hash table entries.
Actually, now that I look more carefully, I don't think we need to do
anything special at all. The only weirdness is that APR, internally,
will interpret the 0 length as meaning it should do a strlen on the
key. But that's fine -- strlen on the empty string will be 0, APR
will add 1, and it will have a key consisting of the null byte. That
works.
/**
* Associate a value with a key in a hash table.
* @param ht The hash table
* @param key Pointer to the key
* @param klen Length of the key
* If the length is 0 it is assumed to be strlen(key)+1
* @param val Value to associate with the key
* @tip If the value is NULL the hash entry is deleted.
* @deffunc void apr_hash_set(apr_hash_t *ht, const void *key, apr_size_t klen, const void *val)
*/
APR_EXPORT(void) apr_hash_set(apr_hash_t *ht, const void *key,
apr_size_t klen, const void *val);
Received on Sat Oct 21 14:36:11 2006