hashmap/include/hashmap.h

21 lines
573 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 char *value);
const char *lookup_map(struct hashmap *map, const char *key);
int exists_map(struct hashmap *map, const char *key);
const char *remove_map(struct hashmap *map, const char *key);
void foreach_map(struct hashmap *map, void (*cb)(const char *key, const char *value));
void print_map(struct hashmap *map);
#endif