2008-11-23 02:12:37 -05:00
|
|
|
#ifndef __HTABLE_H_
|
|
|
|
#define __HTABLE_H_
|
|
|
|
|
2008-12-22 01:36:50 -05:00
|
|
|
#define HT_N_INLINE 16
|
|
|
|
|
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
|
|
|
|
#define HT_NOTFOUND ((void*)1)
|
|
|
|
|
|
|
|
// 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
|