hbmap: fix iterator truncation when size_t < 32bit
[rofl0r-agsutils.git] / hsearch.h
blobbd52081084532baa85405dcf9b3a7c3c3f810aa4
1 #ifndef HSEARCH_H
2 #define HSEARCH_H
4 #include <stdlib.h>
6 typedef union htab_value {
7 void *p;
8 size_t n;
9 } htab_value;
11 #define HTV_N(N) (htab_value) {.n = N}
12 #define HTV_P(P) (htab_value) {.p = P}
14 struct htab * htab_create(size_t);
15 void htab_destroy(struct htab *);
16 htab_value* htab_find(struct htab *, char* key);
17 /* same as htab_find, but can retrieve the saved key (for freeing) */
18 htab_value* htab_find2(struct htab *htab, char* key, char **saved_key);
19 int htab_insert(struct htab *, char*, htab_value);
20 int htab_delete(struct htab *htab, char* key);
21 size_t htab_next(struct htab *, size_t iterator, char** key, htab_value **v);
23 #endif