hashit 0.9.4 review
Downloadhashit is a generic hash library. hashit implements diverse collision handling methods. This function creates a hash table whic
|
|
hashit is a generic hash library.
hashit implements diverse collision handling methods.
This function creates a hash table which is returned as a hash_t type. 'errno' is set to ENOMEM if there wasn't enough memory avaliable for creating the table.
Return value is a reference to the table just created or NULL when the table creation has failed.
Parameters:
sizehint:
It's used to give an aproximated desired value for the hash table, the function calculates the real size of the table using this parameter as a hint to the final value.
keysize:
This is the size for the data type used as a key in the hash table. Keys are void *, so hashit needs to know how long they are. If key size is 0, is assumed that keys are strings.
hfunc:
hfunc is a pointer to the hash function for the hash table. Typically you want to put here the value NULL to use the default hash function. Avaliable hash functions are BOB_HASH(Default) and ONEAT_HASH. You can add your own hash function if you know what are you doing.
cfunc:
cfunc is the comparation function for the keys data. Semantics are the same that in strcmp function. The function should return 0 if both keys are equal, and a value different from zero if they are not.
flags:
flags can have the following values:
CHAIN_H:
Hash table uses chaining for handling collisions
OADDRESS_H:
Hash table uses open address hashing for handling collisions
OVERFLOW_H:
Hasht table uses an overflow area for handling collisions
If you're not sure about what collision handling your hash table should have, then use CHAIN_H.
- int hashit_insert (hash_t htable, void *key, void *data)
What's New in This Release:
The build system was updated to the latest version of mobs.
This version is prepared to use pkg-config files, so hashit has now a .pc file included.
hashit 0.9.4 search tags