fix malloc functions
authorOlivier Matz <zer0@droids-corp.org>
Thu, 13 Sep 2018 18:14:23 +0000 (20:14 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Thu, 13 Sep 2018 18:14:23 +0000 (20:14 +0200)
libecoli/ecoli_malloc.c
libecoli/ecoli_malloc.h

index 505f49f..5a022ae 100644 (file)
@@ -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;
index e80c3d9..42cbf87 100644 (file)
@@ -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.
  *