2008-11-23 02:12:37 -05:00
|
|
|
#ifndef __HTABLE_H_
|
|
|
|
#define __HTABLE_H_
|
|
|
|
|
2009-05-29 00:38:50 -04:00
|
|
|
#define HT_N_INLINE 32
|
2008-12-22 01:36:50 -05:00
|
|
|
|
2008-11-23 02:12:37 -05:00
|
|
|
typedef struct {
|
|
|
|
size_t size;
|
|
|
|
void **table;
|
2008-12-22 01:36:50 -05:00
|
|
|
void *_space[HT_N_INLINE];
|
2008-11-23 02:12:37 -05:00
|
|
|
} htable_t;
|
|
|
|
|
|
|
|
// 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
|
|
|
|
htable_t *htable_new(htable_t *h, size_t size);
|
|
|
|
void htable_free(htable_t *h);
|
|
|
|
|
|
|
|
// clear and (possibly) change size
|
|
|
|
void htable_reset(htable_t *h, size_t sz);
|
|
|
|
|
|
|
|
#endif
|