-/**
- * @defgroup malloc Memory allocation functions
- * @{
- */
-#if defined(CONFIG_DEBUG_MALLOC) && !defined(IN_MALLOC_C)
-#define free(p) \
- ({ \
- extern void print_malloc_map(void); \
- extern void free(void *); \
- printf("free(%p) called from %s:%s:%d...\n", p, __FILE__, __func__, \
- __LINE__);\
- printf("PRE free()\n"); \
- print_malloc_map(); \
- free(p); \
- printf("POST free()\n"); \
- print_malloc_map(); \
- })
-#define malloc(s) \
- ({ \
- extern void print_malloc_map(void); \
- extern void *malloc(size_t); \
- void *ptr; \
- printf("malloc(%u) called from %s:%s:%d...\n", s, __FILE__, __func__, \
- __LINE__);\
- printf("PRE malloc\n"); \
- print_malloc_map(); \
- ptr = malloc(s); \
- printf("POST malloc (ptr = %p)\n", ptr); \
- print_malloc_map(); \
- ptr; \
- })
-#define calloc(n,s) \
- ({ \
- extern void print_malloc_map(void); \
- extern void *calloc(size_t,size_t); \
- void *ptr; \
- printf("calloc(%u, %u) called from %s:%s:%d...\n", n, s, __FILE__, \
- __func__, __LINE__);\
- printf("PRE calloc\n"); \
- print_malloc_map(); \
- ptr = calloc(n,s); \
- printf("POST calloc (ptr = %p)\n", ptr); \
- print_malloc_map(); \
- ptr; \
- })
-#define realloc(p,s) \
- ({ \
- extern void print_malloc_map(void); \
- extern void *realloc(void*,size_t); \
- void *ptr; \
- printf("realloc(%p, %u) called from %s:%s:%d...\n", p, s, __FILE__, \
- __func__, __LINE__);\
- printf("PRE realloc\n"); \
- print_malloc_map(); \
- ptr = realloc(p,s); \
- printf("POST realloc (ptr = %p)\n", ptr); \
- print_malloc_map(); \
- ptr; \
- })
-#define memalign(a,s) \
- ({ \
- extern void print_malloc_map(void); \
- extern void *memalign(size_t, size_t); \
- void *ptr; \
- printf("memalign(%u, %u) called from %s:%s:%d...\n", a, s, __FILE__, \
- __func__, __LINE__);\
- printf("PRE memalign\n"); \
- print_malloc_map(); \
- ptr = memalign(a,s); \
- printf("POST realloc (ptr = %p)\n", ptr); \
- print_malloc_map(); \
- ptr; \
- })
-#else
-void free(void *ptr);
-void *malloc(size_t size);
-void *calloc(size_t nmemb, size_t size);
-void *realloc(void *ptr, size_t size);
-void *memalign(size_t align, size_t size);
-#endif
-/** @} */