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

Go to the source code of this file.

Functions

 __declspec (noinline) _CRTRESTRICT void *__cdecl _realloc_base(void *const block
 
 if (size==0)
 
 _VALIDATE_RETURN_NOEXC (_HEAP_MAXREQ >=size, ENOMEM, nullptr)
 
 for (;;)
 

Variables

size_t const size
 

Function Documentation

◆ __declspec()

__declspec ( noinline  ) const

◆ _VALIDATE_RETURN_NOEXC()

_VALIDATE_RETURN_NOEXC ( _HEAP_MAXREQ >=  size,
ENOMEM  ,
nullptr   
)

◆ for()

for ( ;;  )

Definition at line 43 of file realloc_base.cpp.

44 {
45 void* const new_block = HeapReAlloc(__acrt_heap, 0, block, size);
46 if (new_block)
47 return new_block;
48
49 // Otherwise, see if we need to call the new handler, and if so call it.
50 // If the new handler fails, just return nullptr:
51 if (_query_new_mode() == 0 || !_callnewh(size))
52 {
53 errno = ENOMEM;
54 return nullptr;
55 }
56
57 // The new handler was successful; try to allocate again...
58 }
#define ENOMEM
Definition: acclib.h:84
_Check_return_ _ACRTIMP int __cdecl _callnewh(_In_ size_t _Size)
new_block
Definition: debug_heap.cpp:763
#define HeapReAlloc
Definition: compat.h:734
GLsizeiptr size
Definition: glext.h:5919
HANDLE __acrt_heap
Definition: heap_handle.cpp:15
#define errno
Definition: errno.h:18
_ACRTIMP int __cdecl _query_new_mode(void)
Definition: heap.c:217
static unsigned int block
Definition: xmlmemory.c:101

◆ if()

if ( size  = = 0)

Definition at line 34 of file realloc_base.cpp.

35 {
37 return nullptr;
38 }
_ACRTIMP void __cdecl _free_base(_Pre_maybenull_ _Post_invalid_ void *_Block)

Variable Documentation

◆ size

Initial value:
{
if (block == nullptr)
return _malloc_base(size)

Definition at line 26 of file realloc_base.cpp.