]> begriffs open source - libderp/blob - include/hashmap.h
WIP: hashmap with memory leaks
[libderp] / include / hashmap.h
1 #ifndef LIBDERP_HASHMAP_H
2 #define LIBDERP_HASHMAP_H
3
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include <stdint.h>
7
8 typedef struct hashmap hashmap;
9
10 hashmap * hm_new(size_t,
11                  uint_fast32_t (*hash)(const void *),
12                  int (*cmp)(const void *, const void *),
13                  void (*key_dtor)(void *),
14                  void (*val_dtor)(void *));
15 void      hm_free(hashmap *);
16 size_t    hm_length(const hashmap *);
17 bool      hm_is_empty(const hashmap *);
18 void *    hm_at(const hashmap *, const void *);
19 bool      hm_insert(hashmap *, void *key, void *val);
20 bool      hm_remove(hashmap *, void *);
21 void      hm_clear(hashmap *);
22
23 #endif