From: Olivier Matz Date: Thu, 13 Sep 2018 18:14:23 +0000 (+0200) Subject: fix malloc functions X-Git-Url: http://git.droids-corp.org/?p=protos%2Flibecoli.git;a=commitdiff_plain;h=4f6306bf7d571b2789001291ab743255e9de34f5 fix malloc functions --- diff --git a/libecoli/ecoli_malloc.c b/libecoli/ecoli_malloc.c index 505f49f..5a022ae 100644 --- a/libecoli/ecoli_malloc.c +++ b/libecoli/ecoli_malloc.c @@ -43,7 +43,7 @@ void *__ec_malloc(size_t size, const char *file, unsigned int line) void *ec_malloc_func(size_t size) { - return __ec_malloc(size, __FILE__, __LINE__); + return ec_malloc(size); } void __ec_free(void *ptr, const char *file, unsigned int line) @@ -53,7 +53,7 @@ void __ec_free(void *ptr, const char *file, unsigned int line) void ec_free_func(void *ptr) { - __ec_free(ptr, __FILE__, __LINE__); + ec_free(ptr); } void *__ec_calloc(size_t nmemb, size_t size, const char *file, @@ -82,6 +82,11 @@ void *__ec_realloc(void *ptr, size_t size, const char *file, unsigned int line) return ec_malloc_handler.realloc(ptr, size, file, line); } +void ec_realloc_func(void *ptr, size_t size) +{ + ec_realloc(ptr, size); +} + char *__ec_strdup(const char *s, const char *file, unsigned int line) { size_t sz = strlen(s) + 1; diff --git a/libecoli/ecoli_malloc.h b/libecoli/ecoli_malloc.h index e80c3d9..42cbf87 100644 --- a/libecoli/ecoli_malloc.h +++ b/libecoli/ecoli_malloc.h @@ -171,6 +171,14 @@ void ec_free_func(void *ptr); ret_; \ }) +/** + * Ecoli realloc function. + * + * Use this function when the macro ec_realloc() cannot be used, + * for instance when it is passed as a callback pointer. + */ +void ec_realloc_func(void *ptr, size_t size); + /** * Allocate and initialize an array of elements. *