89 const char *
filename,
long line,
const char *
function);
91 const char *
filename,
long line,
const char *
function);
93 const char *
filename,
long line,
const char *
function);
95 const char *
filename,
long line,
const char *
function);
97 const char *
filename,
long line,
const char *
function);
101 const char *
filename,
long line,
const char *
function);
110 #define USE_GWMEM_CHECK 1 120 #define gw_init_mem() 121 #define gw_check_leaks() 122 #define gw_malloc(size) (gw_native_malloc(size)) 123 #define gw_malloc_trace(size, file, line, func) (gw_native_malloc(size)) 124 #define gw_calloc(nmemb, size) (gw_native_calloc(nmemb, size)) 125 #define gw_realloc(ptr, size) (gw_native_realloc(ptr, size)) 126 #define gw_free(ptr) (gw_native_free(ptr)) 127 #define gw_strdup(str) (gw_native_strdup(str)) 128 #define gw_assert_allocated(ptr, file, line, function) 129 #define gw_claim_area(ptr) (gw_native_noop(ptr)) 130 #define gw_claim_area_for(ptr, file, line, func) (gw_native_noop(ptr)) 131 #define gwmem_shutdown() 132 #define gwmem_type() (octstr_imm("native")) 134 #elif USE_GWMEM_CHECK 140 #ifdef USE_GWMEM_SLOW 141 #define gw_init_mem() (gw_check_init_mem(1)) 142 #define gwmem_type() (octstr_imm("slow")) 144 #define gw_init_mem() (gw_check_init_mem(0)) 145 #define gwmem_type() (octstr_imm("checking")) 148 #define gw_check_leaks() (gw_check_check_leaks()) 149 #define gw_malloc_trace(size, file, line, func) \ 150 (gw_check_malloc(size, file, line, func)) 151 #define gw_malloc(size) \ 152 (gw_check_malloc(size, __FILE__, __LINE__, __func__)) 153 #define gw_calloc(nmemb, size) \ 154 (gw_check_calloc(nmemb, size, __FILE__, __LINE__, __func__)) 155 #define gw_realloc(ptr, size) \ 156 (gw_check_realloc(ptr, size, __FILE__, __LINE__, __func__)) 157 #define gw_free(ptr) \ 158 (gw_check_free(ptr, __FILE__, __LINE__, __func__)) 159 #define gw_strdup(str) \ 160 (gw_check_strdup(str, __FILE__, __LINE__, __func__)) 161 #define gw_assert_allocated(ptr, file, line, function) \ 162 (gw_assert_place(gw_check_is_allocated(ptr), file, line, function)) 163 #define gw_claim_area(ptr) \ 164 (gw_check_claim_area(ptr, __FILE__, __LINE__, __func__)) 165 #define gw_claim_area_for(ptr, file, line, func) \ 166 (gw_check_claim_area(ptr, file, line, func)) 167 #define gwmem_shutdown() (gw_check_shutdown()) 174 #error "Unknown malloc wrapper." 191 #define malloc(n) do_not_call_malloc_directly 192 #define calloc(a, b) do_not_use_calloc 193 #define realloc(p, n) do_not_call_realloc_directly 194 #define free(p) do_not_call_free_directly 195 #define strdup(p) do_not_call_strdup_directly void gw_check_free(void *p, const char *filename, long line, const char *function)
void * gw_native_noop(void *ptr)
char * gw_check_strdup(const char *str, const char *filename, long line, const char *function)
void gw_native_init(void)
void gw_check_shutdown(void)
void * gw_check_claim_area(void *p, const char *filename, long line, const char *function)
void * gw_check_malloc(size_t size, const char *filename, long line, const char *function)
void gw_native_shutdown(void)
void gw_native_check_leaks(void)
void * gw_native_calloc(int nmemb, size_t size)
char * gw_native_strdup(const char *str)
void gw_check_check_leaks(void)
int gw_check_is_allocated(void *p)
void gw_native_free(void *ptr)
char filename[FILENAME_MAX+1]
void * gw_check_realloc(void *p, size_t size, const char *filename, long line, const char *function)
void * gw_check_calloc(int nmemb, size_t size, const char *filename, long line, const char *function)
long gw_check_area_size(void *p)
void * gw_native_malloc(size_t size)
void * gw_native_realloc(void *ptr, size_t size)
void gw_check_init_mem(int slow_flag)