VS2008 project files.
[xiph/unicode.git] / w3d / mem.h
blob2da85cf165c4614bace06c92758c1c7bef996c3e
1 #ifndef __MEM_H
2 #define __MEM_H
4 #include <stdlib.h>
5 #include <string.h>
6 #include <stdio.h>
9 #if defined(DBG_MEMLEAKS)
11 extern void* dbg_malloc (char *file, int line, char *func, size_t bytes);
12 extern void* dbg_calloc (char *file, int line, char *func, size_t count, size_t bytes);
13 extern void* dbg_realloc (char *file, int line, char *func, char *what, void *mem, size_t bytes);
14 extern void dbg_free (char *file, int line, char *func, char *what, void *mem);
16 #define MALLOC(bytes) dbg_malloc(__FILE__,__LINE__,__FUNCTION__,bytes)
17 #define CALLOC(count,bytes) dbg_calloc(__FILE__,__LINE__,__FUNCTION__,count,bytes)
18 #define FREE(mem) dbg_free(__FILE__,__LINE__,__FUNCTION__,#mem,mem)
19 #define REALLOC(mem,bytes) dbg_realloc(__FILE__,__LINE__,__FUNCTION__,#mem,mem,bytes)
21 #else
23 #define MALLOC malloc
24 #define CALLOC calloc
25 #define REALLOC realloc
26 #define FREE free
28 #endif
30 #endif