ReactOS 0.4.16-dev-927-g467dec4
new_handler.cpp File Reference
#include <corecrt_internal.h>
#include <new.h>
Include dependency graph for new_handler.cpp:

Go to the source code of this file.

Functions

void __cdecl __acrt_initialize_new_handler (void *const encoded_null)
 
_PNH __cdecl _set_new_handler (_PNH new_handler)
 
_PNH __cdecl _set_new_handler (int const new_handler)
 
_PNH __cdecl _query_new_handler ()
 
int __cdecl _callnewh (size_t const size)
 

Variables

static __crt_state_management::dual_state_global< _PNH > __acrt_new_handler
 

Function Documentation

◆ __acrt_initialize_new_handler()

void __cdecl __acrt_initialize_new_handler ( void *const  encoded_null)

Definition at line 18 of file new_handler.cpp.

19{
20 __acrt_new_handler.initialize(reinterpret_cast<_PNH>(encoded_null));
21}
static __crt_state_management::dual_state_global< _PNH > __acrt_new_handler
Definition: new_handler.cpp:13

Referenced by initialize_pointers().

◆ _callnewh()

int __cdecl _callnewh ( size_t const  size)

Definition at line 77 of file new_handler.cpp.

78{
79 _PNH const pnh = _query_new_handler();
80
81 if (pnh == nullptr || (*pnh)(size) == 0)
82 return 0;
83
84 return 1;
85}
GLsizeiptr size
Definition: glext.h:5919
_PNH __cdecl _query_new_handler()
Definition: new_handler.cpp:56

◆ _query_new_handler()

_PNH __cdecl _query_new_handler ( void  )

Definition at line 56 of file new_handler.cpp.

57{
58 _PNH result = nullptr;
59
61 __try
62 {
63 result = __crt_fast_decode_pointer(__acrt_new_handler.value());
64 }
66 {
68 }
70
71 return result;
72}
void __cdecl __acrt_unlock(_In_ __acrt_lock_id lock)
Definition: locks.cpp:57
@ __acrt_heap_lock
__acrt_lock(__acrt_heap_lock)
GLuint64EXT * result
Definition: glext.h:11304
#define __try
Definition: pseh2_64.h:188
#define __endtry
Definition: pseh2_64.h:191
#define __finally
Definition: pseh2_64.h:190

Referenced by _callnewh().

◆ _set_new_handler() [1/2]

_PNH __cdecl _set_new_handler ( _PNH  new_handler)

Definition at line 24 of file new_handler.cpp.

25{
26 _PNH result = nullptr;
27
29 __try
30 {
31 result = __crt_fast_decode_pointer(__acrt_new_handler.value());
32 __acrt_new_handler.value() = __crt_fast_encode_pointer(new_handler);
33 }
35 {
37 }
39
40 return result;
41}

Referenced by _set_new_handler().

◆ _set_new_handler() [2/2]

_PNH __cdecl _set_new_handler ( int const  new_handler)

Definition at line 45 of file new_handler.cpp.

46{
47 // This is referenced only in the Debug CRT build
48 UNREFERENCED_PARAMETER(new_handler);
49
50 _ASSERTE(new_handler == 0);
51
52 return _set_new_handler(__crt_fast_encode_pointer(nullptr));
53}
#define _ASSERTE(expr)
Definition: crtdbg.h:114
_PNH __cdecl _set_new_handler(_PNH new_handler)
Definition: new_handler.cpp:24
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325

Variable Documentation

◆ __acrt_new_handler

__crt_state_management::dual_state_global<_PNH> __acrt_new_handler
static