24 lines
733 B
C

#ifndef MONS_HASHMAP_H
#define MONS_HASHMAP_H
typedef struct mons_hashmap_pair {
char *key;
void *value;
struct mons_hashmap_pair *next;
} mons_hashmap_pair;
typedef struct mons_hashmap {
mons_hashmap_pair **data;
unsigned int bucket_count;
unsigned int member_size;
unsigned int len;
} mons_hashmap;
mons_hashmap mons_hashmap_new(unsigned int member_size, unsigned int buckets);
void mons_hashmap_free(mons_hashmap *hashmap);
int mons_hashmap_insert(mons_hashmap *map, char *key, void *value);
int mons_hashmap_get(mons_hashmap map, char *key, void *out);
int mons_hashmap_remove(mons_hashmap *map, char *key);
int mons_hashmap_at(mons_hashmap map, unsigned int index, mons_hashmap_pair *out);
#endif