1 #ifndef _TM_MALLOC_H_
2 #define _TM_MALLOC_H_
3
4 #include <stdlib.h>
5 void *tm_malloc(size_t size, char *, int);
6 void *tm_calloc(size_t count, size_t size, char *, int);
7 void *tm_realloc(void *ptr, size_t size, char *, int);
8 void tm_free(void *ptr);
9 void tm_mem_check(void);
10
11
12
13 #undef __DEBUG_TM_MALLOC__
14 #ifdef __DEBUG_TM_MALLOC__
15 #define MALLOC(x) tm_malloc(x,__FILE__,__LINE__)
16 #define CALLOC(x,y) tm_calloc(x,y,__FILE__,__LINE__)
17 #define REALLOC(x,y) tm_realloc(x,y,__FILE__,__LINE__)
18 #define FREE tm_free
19 #define MEM_CHECK tm_mem_check
20 #else
21 #define MALLOC malloc
22 #define CALLOC calloc
23 #define FREE free
24 #define REALLOC realloc
25 #define MEM_CHECK tm_mem_check
26 #endif
27
28
29 #endif