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.

114 lines
2.1 KiB

  1. /***
  2. *new.h - declarations and definitions for C++ memory allocation functions
  3. *
  4. * Copyright (c) 1990-2000, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Contains the declarations for C++ memory allocation functions.
  8. *
  9. * [Public]
  10. *
  11. ****/
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif
  15. #ifndef _INC_NEW
  16. #define _INC_NEW
  17. #ifdef __cplusplus
  18. #ifndef _MSC_EXTENSIONS
  19. #include <new>
  20. #endif
  21. #if !defined(_WIN32)
  22. #error ERROR: Only Win32 target supported!
  23. #endif
  24. #if !defined(_W64)
  25. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
  26. #define _W64 __w64
  27. #else
  28. #define _W64
  29. #endif
  30. #endif
  31. /* Define _CRTIMP */
  32. #ifndef _CRTIMP
  33. #ifdef _DLL
  34. #define _CRTIMP __declspec(dllimport)
  35. #else /* ndef _DLL */
  36. #define _CRTIMP
  37. #endif /* _DLL */
  38. #endif /* _CRTIMP */
  39. /* Define __cdecl for non-Microsoft compilers */
  40. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  41. #define __cdecl
  42. #endif
  43. /* types and structures */
  44. #ifndef _SIZE_T_DEFINED
  45. #ifdef _WIN64
  46. typedef unsigned __int64 size_t;
  47. #else
  48. typedef _W64 unsigned int size_t;
  49. #endif
  50. #define _SIZE_T_DEFINED
  51. #endif
  52. #ifdef _MSC_EXTENSIONS
  53. typedef void (__cdecl * new_handler) ();
  54. _CRTIMP new_handler __cdecl set_new_handler(new_handler);
  55. #endif
  56. #ifndef __PLACEMENT_NEW_INLINE
  57. #define __PLACEMENT_NEW_INLINE
  58. inline void *__cdecl operator new(size_t, void *_P)
  59. {return (_P); }
  60. #if _MSC_VER >= 1200
  61. inline void __cdecl operator delete(void *, void *)
  62. {return; }
  63. #endif
  64. #endif
  65. /*
  66. * new mode flag -- when set, makes malloc() behave like new()
  67. */
  68. _CRTIMP int __cdecl _query_new_mode( void );
  69. _CRTIMP int __cdecl _set_new_mode( int );
  70. #ifndef _PNH_DEFINED
  71. typedef int (__cdecl * _PNH)( size_t );
  72. #define _PNH_DEFINED
  73. #endif
  74. _CRTIMP _PNH __cdecl _query_new_handler( void );
  75. _CRTIMP _PNH __cdecl _set_new_handler( _PNH );
  76. /*
  77. * Microsoft extension:
  78. *
  79. * _NO_ANSI_NEW_HANDLER de-activates the ANSI new_handler. Use this special value
  80. * to support old style (_set_new_handler) behavior.
  81. */
  82. #ifndef _NO_ANSI_NH_DEFINED
  83. #define _NO_ANSI_NEW_HANDLER ((new_handler)-1)
  84. #define _NO_ANSI_NH_DEFINED
  85. #endif
  86. #endif /* __cplusplus */
  87. #endif /* _INC_NEW */