1 #ifdef _DEBUG_MEM 2 3 #define cmd_alloc(size) cmd_alloc_dbg(size, __FILE__, __LINE__) 4 #define cmd_realloc(ptr,size) cmd_realloc_dbg(ptr, size, __FILE__, __LINE__) 5 #define cmd_free(ptr) cmd_free_dbg(ptr, __FILE__, __LINE__) 6 #define cmd_checkbuffer(ptr) cmd_checkbuffer_dbg(ptr, __FILE__, __LINE__) 7 #define cmd_dup(str) cmd_dup_dbg(str, __FILE__, __LINE__) 8 9 void * 10 cmd_alloc_dbg(size_t size, const char *file, int line); 11 12 void * 13 cmd_realloc_dbg(void *ptr, size_t size, const char *file, int line); 14 15 void 16 cmd_free_dbg(void *ptr, const char *file, int line); 17 18 TCHAR * 19 cmd_dup_dbg(const TCHAR *str, const char *file, int line); 20 21 void 22 cmd_checkbuffer_dbg(void *ptr, const char *file, int line); 23 24 void 25 cmd_exit(int code); 26 27 #else 28 29 #define cmd_alloc(size) malloc(size) 30 #define cmd_realloc(ptr,size) realloc(ptr, size) 31 #define cmd_free(ptr) free(ptr) 32 #define cmd_dup(str) _tcsdup(str) 33 #define cmd_checkbuffer(ptr) 34 #define cmd_exit(code) ExitProcess(code) 35 36 #endif 37