diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/malloc.c | 2 | ||||
-rw-r--r-- | src/common/malloc.h | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c index fad5183d1..ed5fb2e44 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -1,3 +1,4 @@ +#if !defined(DMALLOC) && !defined(GCOLLECT) && !defined(BCHECK) #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -49,3 +50,4 @@ void * _bcalloc(size_t size, size_t cnt) { memset(ret, 0, size * cnt); return ret; } +#endif diff --git a/src/common/malloc.h b/src/common/malloc.h index 7b09d7074..860f8dd7b 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -3,8 +3,18 @@ #include <stdlib.h> -#if defined(GCOLLECT) +#if defined(DMALLOC) +#include "dmalloc.h" + +#define aMalloc(size) \ + dmalloc_malloc(__FILE__, __LINE__, (size), DMALLOC_FUNC_MALLOC, 0, 0) +#define aCalloc(count,size) \ + dmalloc_malloc(__FILE__, __LINE__, (count)*(size), DMALLOC_FUNC_CALLOC, 0, 0) +#define aRealloc(ptr,size) \ + dmalloc_realloc(__FILE__, __LINE__, (ptr), (size), DMALLOC_FUNC_REALLOC, 0) + +#elif defined(GCOLLECT) #include "gc.h" #define aMalloc(n) GC_MALLOC(n) #define aCalloc(m,n) _bcalloc(m,n) |