Introduction
This is a simple key-value pair hashtable written in C, uses FNV-1 as default hash algorithm.
Using the code
You can see an extended example of how to use this hashtable in the file main.c.
Initialization
hashtable_t tbl;
hashtable_init(&tbl, hashtable_hash_fnv, (hashtable_len_function)strlen);
Adding elements
hashtable_set(&tbl, "key", "value");
Removing elements
hashtable_remove(&tbl, "key");
Clearing the table
hashtable_clear(&tbl);
Finally, destroy the table(actually, this just call hashtable_clear
)
hashtable_destroy(&tbl);
Points of Interest
This hashtable favors neither search neither insertion. If you want a search favored hashtable you must sort the elements.
History
05/05/2012 - First version.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.