Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.6 KiB

  1. /* Prototypes for "safe" (but slow) malloc/free routines to be used
  2. * in development of Large model Windows applications.
  3. *
  4. * lenoxb 5/28/93
  5. */
  6. #ifndef _ARGS
  7. # define IN const
  8. # define OUT
  9. # define INOUT
  10. # define _ARGS(arg) arg
  11. #endif
  12. /***********
  13. ** Debug version of memory management functions.
  14. **
  15. */
  16. #if TRACEMEM
  17. void* SafeMalloc _ARGS((INOUT size_t,
  18. INOUT char *,
  19. INOUT short));
  20. void* SafeReAlloc _ARGS((INOUT void*,
  21. INOUT size_t,
  22. INOUT char *,
  23. INOUT short));
  24. void SafeFree _ARGS((INOUT void*));
  25. void SafeListMemLeak _ARGS((INOUT void));
  26. char* SafeStrdup _ARGS((IN char*,
  27. INOUT char *,
  28. INOUT short));
  29. #define Malloc(size) SafeMalloc(size, __FILE__, __LINE__)
  30. #define Realloc(ptr, size) SafeReAlloc(ptr, size, __FILE__, __LINE__)
  31. #define Free(ptr) SafeFree(ptr)
  32. #define Strdup(ptr) SafeStrdup(ptr, __FILE__, __LINE__)
  33. #define ListMemLeak SafeListMemLeak
  34. #else
  35. /***********
  36. ** Run-time version of memory management functions.
  37. **
  38. */
  39. /*#include <stddef.h>*/
  40. #include <stdlib.h>
  41. #define Malloc(size) malloc(size)
  42. #define Realloc(ptr,size) realloc(ptr, (size_t)(size))
  43. #define Free free
  44. #define Strdup _strdup
  45. #define ListMemLeak() ;
  46. #endif