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.

52 lines
1.7 KiB

  1. /***
  2. *new2.cpp - defines C++ new routine
  3. *
  4. * Copyright (c) 1990-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Defines C++ new routine.
  8. *
  9. *Revision History:
  10. * 05-07-90 WAJ Initial version.
  11. * 08-30-90 WAJ new now takes unsigned ints.
  12. * 08-08-91 JCR call _halloc/_hfree, not halloc/hfree
  13. * 08-13-91 KRS Change new.hxx to new.h. Fix copyright.
  14. * 08-13-91 JCR ANSI-compatible _set_new_handler names
  15. * 10-30-91 JCR Split new, delete, and handler into seperate sources
  16. * 11-13-91 JCR 32-bit version
  17. * 02-16-94 SKS Move set_new_handler functionality here from malloc()
  18. * 03-01-94 SKS _pnhHeap must be declared in malloc.c, not here
  19. * 03-03-94 SKS New handler functionality moved to malloc.c but under
  20. * a new name, _nh_malloc().
  21. * 02-01-95 GJF #ifdef out the change above for the Mac (temporary).
  22. * 05-01-95 GJF Spliced on winheap version.
  23. * 05-08-95 CFW Turn on new handling for Mac.
  24. * 05-22-98 JWM Support for KFrei's RTC work, and operator new[].
  25. * 07-28-98 JWM RTC update.
  26. * 11-04-98 JWM Split off from new.cpp for better granularity.
  27. * 05-12-99 PML Win64 fix: unsigned -> size_t
  28. * 05-26-99 KBF Updated RTC hook func params
  29. *
  30. *******************************************************************************/
  31. #include <cruntime.h>
  32. #include <malloc.h>
  33. #include <new.h>
  34. #include <stdlib.h>
  35. #ifdef WINHEAP
  36. #include <winheap.h>
  37. #include <rtcsup.h>
  38. #else /* WINHEAP */
  39. #include <heap.h>
  40. #endif /* WINHEAP */
  41. void * operator new[]( size_t cb )
  42. {
  43. void *res = operator new(cb);
  44. RTCCALLBACK(_RTC_Allocate_hook, (res, cb, 0));
  45. return res;
  46. }