- Notifications
You must be signed in to change notification settings - Fork58
clibs/hash
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
C hash implementation based on khash.
Install withclib:
$ clib install clibs/hash
hash_t*hash=hash_new();hash_set(hash,"name","tobi");hash_set(hash,"species","ferret");hash_set(hash,"age","2");hash_each(hash, {printf("%s: %s\n",key, (char*)val);});hash_free(hash);
yields:
species: ferretage: 2name: tobi
The hash type.
Allocate and initialize a new hash.
Free the hash, you must free values appropriately.
Return the number of values in the hash table.
Remove all values from the hash.
Setkey
toval
.
Get value forkey
orNULL.
Check if the hash containskey
.
Removekey
from the hash.
A macro for iterating key/value pairs.
hash_each(users, {printf("%s: %s\n",key, (char*)val);})
A macro for iterating keys only.
hash_each_key(users, {printf("%s\n",key);})
A macro for iterating values only.
hash_each_val(users, {printf("%s\n", (char*)val);})
About
C hash implementation based on khash
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors6
Uh oh!
There was an error while loading.Please reload this page.