1 #ifndef ACL_BINHASH_INCLUDE_H 2 #define ACL_BINHASH_INCLUDE_H 79 #define ACL_BINHASH_FLAG_KEY_REUSE (1 << 0) 80 #define ACL_BINHASH_FLAG_SLICE_RTGC_OFF (1 << 1) 81 #define ACL_BINHASH_FLAG_SLICE1 (1 << 2) 82 #define ACL_BINHASH_FLAG_SLICE2 (1 << 3) 83 #define ACL_BINHASH_FLAG_SLICE3 (1 << 4) 152 #define ACL_BINHASH_STAT_OK 0 153 #define ACL_BINHASH_STAT_INVAL 1 154 #define ACL_BINHASH_STAT_DUPLEX_KEY 2 155 #define ACL_BINHASH_STAT_NO_KEY 3 179 #define ACL_BINHASH_ITER_KEY(iter) ((iter).ptr->key.c_key) 180 #define acl_binhash_iter_key ACL_BINHASH_ITER_KEY 182 #define ACL_BINHASH_ITER_VALUE(iter) ((iter).ptr->value) 183 #define acl_binhash_iter_value ACL_BINHASH_ITER_VALUE 213 #define ACL_BINHASH_FOREACH(iter, table_ptr) \ 215 for((iter).size = acl_binhash_size((table_ptr)), (iter).i = 0, \ 216 (iter).h = acl_binhash_data((table_ptr)); (iter).i < (iter).size; (iter).i++) \ 217 for ((iter).ptr = *(iter).h++; (iter).ptr; (iter).ptr = (iter).ptr->next) 218 #define ACL_BINHASH_FOREACH_REVERSE(iter, table_ptr) \ 220 for((iter).size = acl_binhash_size((table_ptr)), (iter).i = (iter).size - 1, \ 221 (iter).h = acl_binhash_data((table_ptr)) + (iter).i; (iter).i >= 0; (iter).i--) \ 222 for ((iter).ptr = *(iter).h--; (iter).ptr; (iter).ptr = (iter).ptr->next) 224 #define ACL_BINHASH_FOREACH(iter, table_ptr) \ 226 for((void) acl_binhash_iter_head((table_ptr), &iter); \ 228 (void) acl_binhash_iter_next(&iter)) 229 #define ACL_BINHASH_FOREACH_REVERSE(iter, table_ptr) \ 231 for((void) acl_binhash_iter_tail((table_ptr), &iter); \ 233 (void) acl_binhash_iter_prev(&iter)) 236 #define acl_binhash_foreach ACL_BINHASH_FOREACH 237 #define acl_binhash_foreach_reverse ACL_BINHASH_FOREACH_REVERSE ACL_API const ACL_BINHASH_INFO * acl_binhash_iter_head(ACL_BINHASH *table, ACL_BINHASH_ITER *iter)
ACL_API void acl_binhash_walk(ACL_BINHASH *table, void(*walk_fn)(ACL_BINHASH_INFO *, void *), void *arg)
ACL_API ACL_BINHASH_INFO ** acl_binhash_data(ACL_BINHASH *table)
struct ACL_BINHASH_INFO * next
unsigned(* ACL_HASH_FN)(const void *buf, size_t len)
ACL_API int acl_binhash_size(const ACL_BINHASH *table)
ACL_API void acl_binhash_free(ACL_BINHASH *table, void(*free_fn)(void *))
ACL_API const ACL_BINHASH_INFO * acl_binhash_iter_tail(ACL_BINHASH *table, ACL_BINHASH_ITER *iter)
ACL_API int acl_binhash_used(ACL_BINHASH *table)
struct ACL_BINHASH_ITER ACL_BINHASH_ITER
ACL_API const ACL_BINHASH_INFO * acl_binhash_iter_next(ACL_BINHASH_ITER *iter)
ACL_API ACL_BINHASH_INFO * acl_binhash_locate(ACL_BINHASH *table, const void *key, int key_len)
ACL_API void * acl_binhash_find(ACL_BINHASH *table, const void *key, int key_len)
struct ACL_BINHASH_INFO * prev
ACL_API int acl_binhash_errno(ACL_BINHASH *table)
ACL_API ACL_BINHASH * acl_binhash_create(int size, unsigned int flag)
ACL_API ACL_BINHASH_INFO * acl_binhash_enter(ACL_BINHASH *table, const void *key, int key_len, void *value)
ACL_API int acl_binhash_delete(ACL_BINHASH *table, const void *key, int key_len, void(*free_fn)(void *))
ACL_API const ACL_BINHASH_INFO * acl_binhash_iter_prev(ACL_BINHASH_ITER *iter)
struct ACL_SLICE ACL_SLICE
ACL_API ACL_BINHASH_INFO ** acl_binhash_list(ACL_BINHASH *table)