home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / os2sdk / os2sdk12 / stock / mem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-12  |  1.0 KB  |  36 lines

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