31 lines
736 B
C
31 lines
736 B
C
#ifndef __HF__HASHMAP_H__
|
|
#define __HF__HASHMAP_H__
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "hydroforth.h"
|
|
|
|
struct hf__hashmap__node {
|
|
hf__hash_t hash;
|
|
void *value;
|
|
struct hf__hashmap__node *next;
|
|
};
|
|
|
|
struct hf__hashmap {
|
|
struct hf__hashmap__node **arr;
|
|
size_t cap;
|
|
};
|
|
|
|
extern void hf__hashmap__insert(struct hf__hashmap *const hashmap,
|
|
const hf__hash_t hash, void *value);
|
|
|
|
extern void **hf__hashmap__get(const struct hf__hashmap *const hashmap,
|
|
const hf__hash_t hash);
|
|
|
|
typedef void (*hf__hashmap__free_value_t)(void *);
|
|
|
|
extern void hf__hashmap__free(struct hf__hashmap *const hashmap,
|
|
const hf__hashmap__free_value_t free_value);
|
|
|
|
#endif
|