-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashtable.h
More file actions
executable file
·52 lines (47 loc) · 1.42 KB
/
Hashtable.h
File metadata and controls
executable file
·52 lines (47 loc) · 1.42 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
*
*/
struct entry
{
void *k, *v;
unsigned int h;
struct entry *next;
};
typedef struct hashtable
{
char *name;
struct entry **table;
unsigned int tablelength; /* number of bins */
unsigned int index;
unsigned int startindex;
unsigned int chainindex;
unsigned int entrycount;
unsigned int updcount; /* update count */
unsigned int dupcount; /* duplicate count */
unsigned int primeindex;
unsigned int loadlimit;
unsigned int (*hashfn) (void *k);
int (*eqfn) (void *k1, void *k2);
unsigned int resize_count;
unsigned int high_water;
unsigned int low_water;
int status;
} Hashtable;
void Hashtable_set_name (Hashtable *h,char *name) ;
Hashtable* Hashtable_create (unsigned int minsize,
unsigned int (*hashf) (void *), int (*eqf) (void *, void *));
//void Hashtable (Hashtable *h);
void *Hashtable_first (Hashtable *h);
void *Hashtable_next (Hashtable *h);
void Hashtable_clear (Hashtable * h);
void *Hashtable_del (Hashtable * h, void *k);
void Hashtable_destroy (Hashtable * h, int free_values);
unsigned int hash (Hashtable * h, void *k);
int Hashtable_expand (Hashtable *h);
unsigned int Hashtable_count (Hashtable *h);
int Hashtable_add (Hashtable *h, void *k, void *v, int allow_dup);
void * Hashtable_get (Hashtable *h, void *k);
int Hashtable_loop (Hashtable * h, void (*callback) (void *));
#define MAX(x, y) ((x) >= (y) ? (x) : (y))
#define MIN(x, y) ((x) <= (y) ? (x) : (y))
#define MALLOC 1000