42 #define dlisth_init(h) \ 45 (__h)->next = (__h)->prev = (__h); \ 48 #define dlisth_is_empty(h) ((h)->next == (h) && (h)->prev == (h)) 50 #define dlisth_delete(h_) \ 53 (__h)->next->prev = (__h)->prev; \ 54 (__h)->prev->next = (__h)->next; \ 55 (__h)->next = (__h)->prev = (__h); \ 58 #define dlisth_insert_before(ih, bh) \ 60 dlisth *__ih = (ih); \ 61 dlisth *__bh = (bh); \ 62 (__ih)->next = (__bh); \ 63 (__ih)->prev = (__bh)->prev; \ 64 (__bh)->prev->next = (__ih); \ 65 (__bh)->prev = (__ih); \ 68 #define dlisth_insert_after(ih, bh) \ 70 dlisth *__ih = (ih); \ 71 dlisth *__bh = (bh); \ 72 (__ih)->prev = (__bh); \ 73 (__ih)->next = (__bh)->next; \ 74 (__bh)->next->prev = (__ih); \ 75 (__bh)->next = (__ih); \ 86 typedef int (*
ht_keyf) (
void *elem,
void **rk);
97 #define API_MUTEX pthread_mutex_t 98 #define API_MUTEX_INIT(m) pthread_mutex_init(m,NULL) 99 #define API_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER 100 #define API_LOCK(m) pthread_mutex_lock(m) 101 #define API_UNLOCK(m) pthread_mutex_unlock(m) 102 #define API_TRYLOCK(m) pthread_mutex_trylock(m) 103 #define API_MUTEX_DESTROY(m) pthread_mutex_destroy(m) 104 #define API_ONCE_TYPE pthread_once_t 105 #define API_ONCE_INIT PTHREAD_ONCE_INIT 106 #define API_ONCE_FUNC(t,r) pthread_once(t,r) 110 #define API_CALLOC(n,s) api_calloc((n),(s),__FILE__,__LINE__) 111 #define API_MALLOC(s) api_malloc((s),__FILE__,__LINE__) 112 #define API_FREE(p) api_free((p), __FILE__, __LINE__) 113 extern void *
api_calloc (
size_t nmemb,
size_t size,
const char *file,
int line);
114 extern void *
api_malloc (
size_t size,
const char *file,
int line);
115 extern void api_free (
void *ptr,
const char *file,
int line);
121 #define API_CALLOC(n,s) calloc(n,s) 122 #define API_MALLOC(s) malloc(s) 123 #define API_FREE(p) free(p)
void hash_destroy(hash_table *ht, ht_destroyf dtor)
int(* ht_hashf)(void *key, unsigned int *rv)
int hash_lookup(hash_table *ht, void *key, void **elem)
int(* ht_comparef)(void *key1, void *key2, int *r)
int hash_new(int bucket_sz, ht_hashf hashf, ht_keyf keyf, ht_comparef comparef, hash_table **ht)
int api_check_memory(FILE *fp)
int dlisth_map(dlisth *h, dlist_map_func func, void *arg)
int hash_insert(hash_table *ht, void *elem)
int(* ht_keyf)(void *elem, void **rk)
void * api_calloc(size_t nmemb, size_t size, const char *file, int line)
int(* dlist_map_func)(dlisth *h, void *arg, int *cont)
void api_free(void *ptr, const char *file, int line)
int api_malloc_dhook_flag_set
int hash_delete(hash_table *ht, void *key, void **elem)
void(* ht_destroyf)(void *elem)
void * api_malloc(size_t size, const char *file, int line)