5 #define HASH_BUCKETS (1 << 10)
7 typedef struct hash_bucket
{
11 struct hash_bucket
*next
;
14 typedef struct hash_table
{
15 hash_bucket
**buckets
;
21 #define TABLE hash_table *table
22 extern hash_table
*hash_init(size_t buckets
);
23 extern void *hash_find(TABLE
, const char *key
);
24 extern void *hash_find2(TABLE
, const char *k1
, const char *k2
);
25 extern int hash_add(TABLE
, const char *key
, void *data
);
26 extern int hash_add2(TABLE
, const char *k1
, const char *k2
, void *data
);
27 extern int hash_add_unique(TABLE
, const char *key
, void *data
);
28 extern void *hash_update(TABLE
, const char *key
, void *data
);
29 extern void *hash_update2(TABLE
, const char *k1
, const char *k2
, void *data
);
30 extern void *hash_remove(TABLE
, const char *key
);
31 extern void *hash_remove2(TABLE
, const char *k1
, const char *k2
);
32 extern void hash_remove_data(TABLE
, const char *k1
, const void *data
);
33 extern void hash_remove_data2(TABLE
, const char *k1
, const char *k2
, const void *data
);
34 extern void hash_walk_data(TABLE
, int (*walker
)(void *data
));
35 extern int hash_check_table(TABLE
);