#include <cutk/strhmap.h>
#include <stdlib.h>
Defines | |
#define | INLINE_X static inline |
#define | INLINE INLINE_X |
#define | SIZE_MAX ((size_t)-1) |
Functions | |
INLINE size_t | NextPrime (size_t size) |
INLINE size_t | StrHash (const StrHmap *map, const char *s) |
INLINE char | StrEq (const char *s1, const char *s2) |
INLINE int | InsertNew (StrHmap *hashmap, const char *key, const void *item, size_t hash) |
StrHmap * | StrHmapAlloc (size_t size) |
void | StrHmapFree (StrHmap *hashmap) |
int | StrHmapReserve (StrHmap *hashmap, size_t size) |
void * | StrHmapFind (StrHmap *hashmap, const char *key) |
int | StrHmapInsert (StrHmap *hashmap, const char *key, const void *item) |
int | StrHmapReplace (StrHmap *hashmap, const char *key, const void *item) |
int | StrHmapErase (StrHmap *hashmap, const char *key) |
StrHmap * | StrHmapDup (const StrHmap *hashmap) |
int | StrHmapCompact (StrHmap *hashmap) |
void | StrHmapClear (StrHmap *hashmap) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Allocate a new empty hash map.
|
|
Erases all elements in a hash map.
|
|
Rebuilds a hash map. Erased items are removed from the hash map to free up memory.
|
|
Duplicates a hash map.
|
|
Erases an element from the hash map. Note that this will not free memory held by the hash map. Use StrHmaprehash to free up memory after items have been deleted.
|
|
Finds an element in the hash map.
|
|
Releases all memory held by a hash map.
|
|
Inserts a new element into the hash map. This will return an error if the key already exists.
|
|
Inserts or replaces an element in the hash map. This will overwrite existing items in the hash map.
|
|
Reallocates a hash map. If the size is smaller than the actual number of elements in the hash map then the effect will be to reduce memory usage if possible. The size can be larger than the actual number of elements in the hash map which will allow lots of insertions to go faster since the table won't need to be resized as often.
|