From e248c3394d7a2a76cfb39e0955ebab648ecc2bf0 Mon Sep 17 00:00:00 2001 From: Haru Date: Sat, 9 Jan 2016 21:44:27 +0100 Subject: Sanitized various macros Signed-off-by: Haru --- src/common/memmgr.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/common/memmgr.c') diff --git a/src/common/memmgr.c b/src/common/memmgr.c index 97991ceaa..93c23ff18 100644 --- a/src/common/memmgr.c +++ b/src/common/memmgr.c @@ -45,7 +45,7 @@ struct malloc_interface *iMalloc; # define REALLOC(p,n,file,line,func) mwRealloc((p),(n),(file),(line)) # define STRDUP(p,file,line,func) mwStrdup((p),(file),(line)) # define FREE(p,file,line,func) mwFree((p),(file),(line)) -# define MEMORY_USAGE() (size_t)0 +# define MEMORY_USAGE() ((size_t)0) # define MEMORY_VERIFY(ptr) mwIsSafeAddr((ptr), 1) # define MEMORY_CHECK() CHECK() @@ -67,21 +67,21 @@ struct malloc_interface *iMalloc; # include # ifdef GC_ADD_CALLER -# define RETURN_ADDR 0, +# define MALLOC(n,file,line,func) GC_debug_malloc((n), 0, (file), (line)) +# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), 0, (file), (line)) +# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), 0, (file), (line)) +# define STRDUP(p,file,line,func) GC_debug_strdup((p), 0, (file), (line)) # else -# define RETURN_ADDR +# define MALLOC(n,file,line,func) GC_debug_malloc((n), (file), (line)) +# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), (file), (line)) +# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), (file), (line)) +# define STRDUP(p,file,line,func) GC_debug_strdup((p), (file), (line)) # endif -# define MALLOC(n,file,line,func) GC_debug_malloc((n), RETURN_ADDR (file),(line)) -# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), RETURN_ADDR (file),(line)) -# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), RETURN_ADDR (file),(line)) -# define STRDUP(p,file,line,func) GC_debug_strdup((p), RETURN_ADDR (file),(line)) # define FREE(p,file,line,func) GC_debug_free(p) # define MEMORY_USAGE() GC_get_heap_size() # define MEMORY_VERIFY(ptr) (GC_base(ptr) != NULL) # define MEMORY_CHECK() GC_gcollect() -# undef RETURN_ADDR - #else # define MALLOC(n,file,line,func) malloc(n) @@ -89,9 +89,9 @@ struct malloc_interface *iMalloc; # define REALLOC(p,n,file,line,func) realloc((p),(n)) # define STRDUP(p,file,line,func) strdup(p) # define FREE(p,file,line,func) free(p) -# define MEMORY_USAGE() (size_t)0 +# define MEMORY_USAGE() ((size_t)0) # define MEMORY_VERIFY(ptr) true -# define MEMORY_CHECK() +# define MEMORY_CHECK() (void)0 #endif -- cgit v1.2.3-60-g2f50