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.

82 lines
922 B

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1997 - 1999
  3. Module Name:
  4. memfunc.hxx
  5. Abstract:
  6. Common memory utility routines for SENS project.
  7. Author:
  8. Gopal Parupudi <GopalP>
  9. [Notes:]
  10. optional-notes
  11. Revision History:
  12. GopalP 12/4/1997 Start.
  13. --*/
  14. #include <rpc.h>
  15. //
  16. // Common allocator.
  17. //
  18. void * __cdecl
  19. operator new(
  20. IN size_t size
  21. )
  22. {
  23. return (HeapAlloc(GetProcessHeap(), 0, size));
  24. }
  25. void __cdecl
  26. operator delete(
  27. IN void * lpvObj
  28. )
  29. /*++
  30. Notes:
  31. a. We depend on the fact that HeapFree() does the right
  32. thing when lpvObj is NULL.
  33. --*/
  34. {
  35. HeapFree(GetProcessHeap(), 0, lpvObj);
  36. }
  37. //
  38. // Allocator for MIDL stubs
  39. //
  40. extern "C" void __RPC_FAR * __RPC_API
  41. MIDL_user_allocate(
  42. IN size_t len
  43. )
  44. {
  45. return (new char[len]);
  46. }
  47. extern "C" void __RPC_API
  48. MIDL_user_free(
  49. IN void __RPC_FAR * ptr
  50. )
  51. {
  52. delete ptr;
  53. }