21 lines
633 B
C
21 lines
633 B
C
#ifndef __HASHMAP_HASHMAP_H
|
|
#define __HASHMAP_HASHMAP_H
|
|
|
|
#include <linkedlist.h>
|
|
|
|
#define BUCKET_SIZE 64
|
|
|
|
struct hashmap {
|
|
struct ll buckets[BUCKET_SIZE];
|
|
};
|
|
|
|
struct hashmap new_map();
|
|
void insert_map(struct hashmap *map, const char *key, const void *value);
|
|
const void *lookup_map(struct hashmap *map, const char *key);
|
|
const void *lookup_map_default(struct hashmap *map, const char *key, const void *default_value);
|
|
int exists_map(struct hashmap *map, const char *key);
|
|
const void *remove_map(struct hashmap *map, const char *key);
|
|
void foreach_map(struct hashmap *map, void (*cb)(const char *key, const void *value));
|
|
|
|
#endif
|