|
|
|
|
|
|
|
|
|
|
|
#ifdef LC6_DEBUG |
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "../inc/lc6_debug.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void* lc6debug_malloc(size_t size, char *file, const char *func, int line) { |
|
|
|
|
|
printf("[%s:%d] %s called malloc(%lu)\n", file, line, func, size); |
|
|
|
|
|
return malloc(size); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void* lc6debug_realloc(void *ptr, size_t size, char *file, const char *func, int line) { |
|
|
|
|
|
printf("[%s:%d] %s called realloc(%p, %lu)\n", file, line, func, ptr, size); |
|
|
|
|
|
return realloc(ptr, size); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void lc6debug_free(void *ptr, char *file, const char *func, int line) { |
|
|
|
|
|
printf("[%s:%d] %s called free(%p)\n", file, line, func, ptr); |
|
|
|
|
|
free(ptr); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |