Source code of Windows XP (NT5)
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.

86 lines
996 B

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. Mem.hxx
  6. Abstract:
  7. Memory header
  8. Must include Common.hxx.
  9. Author:
  10. Albert Ting (AlbertT) 20-May-1994
  11. Revision History:
  12. --*/
  13. #ifndef _MEM_HXX
  14. #define _MEM_HXX
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. extern BOOL gbAllocFail;
  19. extern LONG gcAllocFail;
  20. PVOID
  21. AllocMem(
  22. UINT cbSize
  23. );
  24. VOID
  25. FreeMem(
  26. PVOID pMem
  27. );
  28. #if DBG
  29. PVOID
  30. DbgAllocMem(
  31. UINT cbSize
  32. );
  33. VOID
  34. DbgFreeMem(
  35. PVOID pMem
  36. );
  37. #endif
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #ifdef __cplusplus
  42. /********************************************************************
  43. The following are used if you want to override a classes'
  44. new and delete using SAFE_NEW.
  45. ********************************************************************/
  46. inline
  47. PVOID
  48. SafeNew(
  49. size_t size
  50. )
  51. {
  52. return AllocMem(size);
  53. }
  54. inline
  55. VOID
  56. SafeDelete(
  57. PVOID pVoid)
  58. {
  59. FreeMem( pVoid );
  60. }
  61. #endif
  62. #endif // ifdef _MEM_HXX