38typedef void *(*ec_malloc_t)(
size_t size,
const char *file,
unsigned int line);
53typedef void (*
ec_free_t)(
void *ptr,
const char *file,
unsigned int line);
71typedef void *(*ec_realloc_t)(
void *ptr,
size_t size,
const char *file,
117#define ec_malloc(size) ({ \
119 if (ec_malloc_handler.malloc == NULL) \
120 ret_ = malloc(size); \
122 ret_ = __ec_malloc(size, __FILE__, __LINE__); \
144#define ec_free(ptr) ({ \
145 if (ec_malloc_handler.free == NULL) \
148 __ec_free(ptr, __FILE__, __LINE__); \
170#define ec_realloc(ptr, size) ({ \
172 if (ec_malloc_handler.realloc == NULL) \
173 ret_ = realloc(ptr, size); \
175 ret_ = __ec_realloc(ptr, size, __FILE__, __LINE__); \
197#define ec_calloc(n, size) ({ \
199 if (ec_malloc_handler.malloc == NULL) \
200 ret_ = calloc(n, size); \
202 ret_ = __ec_calloc(n, size, __FILE__, __LINE__); \
217#define ec_strdup(s) ({ \
219 if (ec_malloc_handler.malloc == NULL) \
222 ret_ = __ec_strdup(s, __FILE__, __LINE__); \
240#define ec_strndup(s, n) ({ \
242 if (ec_malloc_handler.malloc == NULL) \
243 ret_ = strndup(s, n); \
245 ret_ = __ec_strndup(s, n, __FILE__, __LINE__); \
250void *__ec_malloc(
size_t size,
const char *file,
unsigned int line);
251void __ec_free(
void *ptr,
const char *file,
unsigned int line);
252void *__ec_calloc(
size_t nmemb,
size_t size,
const char *file,
254void *__ec_realloc(
void *ptr,
size_t size,
const char *file,
unsigned int line);
255char *__ec_strdup(
const char *s,
const char *file,
unsigned int line);
256char *__ec_strndup(
const char *s,
size_t n,
const char *file,
int ec_malloc_register(ec_malloc_t usr_malloc, ec_free_t usr_free, ec_realloc_t usr_realloc)
void ec_free_func(void *ptr)
void(* ec_free_t)(void *ptr, const char *file, unsigned int line)
void *(* ec_malloc_t)(size_t size, const char *file, unsigned int line)
void * ec_malloc_func(size_t size)
void *(* ec_realloc_t)(void *ptr, size_t size, const char *file, unsigned int line)
void ec_realloc_func(void *ptr, size_t size)