ReactOS
0.4.17-dev-577-ge3e58ac
_recalloc.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS CRT heap support library
3
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4
* PURPOSE: Implementation of _recalloc
5
* COPYRIGHT: Copyright 2026 Timo Kreuzer <timo.kreuzer@reactos.org>
6
*/
7
8
#include <malloc.h>
9
#include <
windef.h
>
10
#include <
winbase.h
>
11
12
void
*
__cdecl
_recalloc
(
void
* Block,
size_t
Count
,
size_t
Size
)
13
{
14
size_t
newSize =
Count
*
Size
;
15
16
if
((
Size
!= 0) && (newSize /
Size
!=
Count
))
17
{
18
return
NULL
;
19
}
20
21
if
(Block ==
NULL
)
22
{
23
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
, newSize);
24
}
25
26
if
(newSize == 0)
27
{
28
HeapFree
(
GetProcessHeap
(), 0, Block);
29
return
NULL
;
30
}
31
32
return
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
, Block, newSize);
33
}
34
35
#ifdef _M_IX86
36
const
void
*
const
_imp___recalloc
=
_recalloc
;
37
#else
38
const
void
*
const
__imp__recalloc
=
_recalloc
;
39
#endif
_recalloc
void *__cdecl _recalloc(void *Block, size_t Count, size_t Size)
Definition:
_recalloc.c:12
__imp__recalloc
const void *const __imp__recalloc
Definition:
_recalloc.c:38
NULL
#define NULL
Definition:
types.h:112
GetProcessHeap
#define GetProcessHeap()
Definition:
compat.h:736
HeapAlloc
#define HeapAlloc
Definition:
compat.h:733
HeapReAlloc
#define HeapReAlloc
Definition:
compat.h:734
HeapFree
#define HeapFree(x, y, z)
Definition:
compat.h:735
HEAP_ZERO_MEMORY
#define HEAP_ZERO_MEMORY
Definition:
compat.h:134
__cdecl
#define __cdecl
Definition:
corecrt.h:121
Count
int Count
Definition:
noreturn.cpp:7
_imp___recalloc
void * _imp___recalloc
Definition:
recalloc.c:31
Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition:
wdfdevice.h:4539
winbase.h
windef.h
sdk
lib
crtheap
_recalloc.c
Generated on Sun Aug 2 2026 06:17:16 for ReactOS by
1.9.6