json-gen-c
0.1.5
json-gen-c generate C code for json manipulation
|
Go to the documentation of this file.
24 #define HASH_MAP_DUPLICATE_KEY 1
26 #define HASH_MAP_ERROR -1
38 unsigned int (*hash_func)(
void *);
39 int (*key_cmp_func)(
void *,
void *);
40 void (*key_free_func)(
void *);
41 void (*value_free_func)(
void *);
76 unsigned int (*hash_func)(
void *),
77 int (*key_cmp_func)(
void *,
void *),
78 void (*key_free_func)(
void *),
79 void (*value_free_func)(
void *));
127 void (*fn)(
void *key,
void *value,
void *ptr),
137 unsigned int hash(
const char *data,
size_t n);
139 unsigned int sstr_key_hash(
void *key);
140 int sstr_key_cmp(
void *a,
void *b);
141 void sstr_key_free(
void *key);
void hash_map_free(struct hash_map *map)
free a hash_map.
Definition: hash_map.c:51
int hash_map_insert(struct hash_map *map, void *key, void *value)
insert a new entry into hash_map.
Definition: hash_map.c:66
void hash_map_entry_free(struct hash_map *map, struct hash_map_entry *entry)
free a hash_map_entry. the key and value will be freed by key_free_func and value_free_func of map.
Definition: hash_map.c:18
void hash_map_for_each(struct hash_map *map, void(*fn)(void *key, void *value, void *ptr), void *ptr)
for each key-value pair in hash_map, call fn(key, value).
Definition: hash_map.c:119
Definition: hash_map.h:34
sstr_t are objects that represent sequences of characters.
Definition: hash_map.h:28
int hash_map_find(struct hash_map *map, void *key, void **value)
find a entry in hash_map.
Definition: hash_map.c:85
struct hash_map * hash_map_new(int bucket_count, unsigned int(*hash_func)(void *), int(*key_cmp_func)(void *, void *), void(*key_free_func)(void *), void(*value_free_func)(void *))
create a new hash_map.
Definition: hash_map.c:26
unsigned int hash(const char *data, size_t n)
calculate the hash value of a key.
Definition: hash_map.c:131
int hash_map_delete(struct hash_map *map, void *key)
remove a entry from hash_map.
Definition: hash_map.c:98
struct hash_map_entry * hash_map_entry_new(void *key, void *value)
create a new hash_map_entry with key and value.
Definition: hash_map.c:6