2009-05-29 00:38:50 -04:00
|
|
|
#define HT_N_INLINE 32
|
2008-12-22 01:36:50 -05:00
|
|
|
|
2019-08-09 12:26:09 -04:00
|
|
|
struct htable {
|
2008-11-23 02:12:37 -05:00
|
|
|
size_t size;
|
|
|
|
void **table;
|
2008-12-22 01:36:50 -05:00
|
|
|
void *_space[HT_N_INLINE];
|
2019-08-09 12:26:09 -04:00
|
|
|
};
|
2008-11-23 02:12:37 -05:00
|
|
|
|
|
|
|
// define this to be an invalid key/value
|
2019-08-09 07:02:02 -04:00
|
|
|
#define HT_NOTFOUND ((void *)1)
|
2008-11-23 02:12:37 -05:00
|
|
|
|
|
|
|
// initialize and free
|
2019-08-09 12:26:09 -04:00
|
|
|
struct htable *htable_new(struct htable *h, size_t size);
|
|
|
|
void htable_free(struct htable *h);
|
2008-11-23 02:12:37 -05:00
|
|
|
|
|
|
|
// clear and (possibly) change size
|
2019-08-09 12:26:09 -04:00
|
|
|
void htable_reset(struct htable *h, size_t sz);
|