-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMEM.H
37 lines (31 loc) · 1.09 KB
/
MEM.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*** mem.h - memory definitions
*
* Definitions of routines that layer C run-time library memory
* routines to provide debugging assistance.
*
* History
* 07-Mar-1990 bens Initial version.
* 08-Mar-1990 bens Added heap check code
* 12-May-1990 bens Upper-case function names
*/
#ifdef CHECKASSERTS
void MyAssert(void *pv,char *pszFile,UINT line);
void * MyAlloc(UINT cb,char *pszFile,UINT line);
void MyCheckHeap(char *pszFile,UINT line);
void MyFree(void *pv,char *pszFile,UINT line);
char * MyStrDup(char *pv,char *pszFile,UINT line);
#define MemAlloc(cb) MyAlloc(cb,__FILE__,__LINE__)
#define MemAssert(pv) MyAssert(pv,__FILE__,__LINE__)
#define MemCheckHeap() MyCheckHeap(__FILE__,__LINE__)
#define MemFree(pv) MyFree(pv,__FILE__,__LINE__)
#define MemStrDup(pv) MyStrDup(pv,__FILE__,__LINE__)
#else
#include <memory.h>
#include <malloc.h>
// No Debug Asserts
#define MemAlloc(cb) malloc(cb)
#define MemAssert(pv)
#define MemCheckHeap()
#define MemFree(pv) free(pv)
#define MemStrDup(pv) strdup(pv)
#endif