65 #define MALLOC_HEADER_SZ 32 110 bp = file_len < 11 ? (
char *) file : (
char *) file + file_len - 11;
111 strncpy (mh->
file, bp, 11);
124 fprintf (fp,
"file: %s, line %d\n", mh->
file, mh->
line);
145 for (tmp = h->
next; tmp != h; tmp = tmp->
next)
147 int r = func (tmp, arg, &cont);
175 sz =
sizeof (*ht) + (bucket_sz - 1) *
sizeof (
ht_bucket);
184 for (i = 0; i < bucket_sz; i++)
242 rc = ht->
hashf (key, &hcode);
248 for (h = header->
next; h != header; h = h->
next)
285 rc = ht->
keyf (elem, &key);
289 rc = ht->
hashf (key, &hcode);
328 rc = ht->
hashf (key, &hcode);
334 for (h = header->
next; h != header; h = h->
next)
366 api_calloc (
size_t nmemb,
size_t size,
const char *file,
int line)
372 return calloc (nmemb, size);
405 return malloc (size);
475 fprintf (fp,
"malloc list not empty (memory leak)\n");
476 for (h = malloc_list.
next; h != &malloc_list; h = h->
next)
int api_check_memory(FILE *fp)
#define dlisth_insert_after(ih, bh)
int hash_insert(hash_table *ht, void *elem)
void hash_destroy(hash_table *ht, ht_destroyf dtor)
int hash_lookup(hash_table *ht, void *key, void **relem)
int hash_delete(hash_table *ht, void *key, void **relem)
static API_ONCE_TYPE once
static void dump_debug_h(debug_malloc_h *mh, FILE *fp)
int(* ht_hashf)(void *key, unsigned int *rv)
static void once_function()
int(* ht_comparef)(void *key1, void *key2, int *r)
void * api_malloc(size_t size, const char *file, int line)
#define dlisth_delete(h_)
int(* ht_keyf)(void *elem, void **rk)
int dlisth_map(dlisth *h, dlist_map_func func, void *arg)
void * api_calloc(size_t nmemb, size_t size, const char *file, int line)
int api_malloc_dhook_flag_set
int(* dlist_map_func)(dlisth *h, void *arg, int *cont)
#define API_ONCE_FUNC(t, r)
static void make_debug_h(debug_malloc_h *mh, const char *file, int line)
static dlisth malloc_list
#define dlisth_is_empty(h)
#define API_MUTEX_INIT(m)
void api_free(void *ptr, const char *file, int line)
void(* ht_destroyf)(void *elem)
int hash_new(int bucket_sz, ht_hashf hashf, ht_keyf keyf, ht_comparef comparef, hash_table **rht)
#define ER_INTERFACE_NO_MORE_MEMORY