forked from robertapengelly/ld86
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashtab.h
36 lines (23 loc) · 828 Bytes
/
hashtab.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/******************************************************************************
* @file hashtab.h
*****************************************************************************/
#ifndef _HASHTAB_H
#define _HASHTAB_H
#include <stddef.h>
struct hashtab_name {
const char *chars;
unsigned long bytes, hash;
};
struct hashtab_entry {
struct hashtab_name *key;
void *value;
};
struct hashtab {
struct hashtab_entry *entries;
unsigned long capacity, count, used;
};
struct hashtab_name *hashtab_alloc_name (const char *str);
int hashtab_put (struct hashtab *table, struct hashtab_name *key, void *value);
void *hashtab_get (struct hashtab *table, struct hashtab_name *key);
void hashtab_remove (struct hashtab *table, struct hashtab_name *key);
#endif /* _HASHTAB_H */