forked from micro222/chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashtable.h
27 lines (20 loc) · 653 Bytes
/
hashtable.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
#ifndef HASHTABLE_H_INCLUDED
#define HASHTABLE_H_INCLUDED
#define DEFAULT_HASHSIZE 200
struct nlist { /* table entry: */
struct nlist *next; /* next entry in chain */
char *name; /* defined name */
char *defn; /* replacement text */
};
struct hashtable {
int size;
unsigned int **data;
};
typedef struct nlist nlist;
typedef struct hashtable hashtable;
hashtable *create_hashtable(int expected_size);
void destroy_hashtable(hashtable *ht);
hashtable *regrow_hashtable(hashtable *ht, int new_hash_size);
nlist *lookup(hashtable *ht, char *s);
nlist *write(hashtable *ht, char *name, char *defn);
#endif // HASHTABLE_H_INCLUDED