ReactOS
0.4.16-dev-1946-g52006dd
calloc.cpp
Go to the documentation of this file.
1
//
2
// calloc.cpp
3
//
4
// Copyright (c) Microsoft Corporation. All rights reserved.
5
//
6
// Implementation of calloc(). Note that _calloc_base is defined in its own
7
// source file to resolve various issues when linking.
8
//
9
#include <
corecrt_internal.h
>
10
#include <malloc.h>
11
12
// Allocates a block of memory of size 'count * size' in the heap. The newly
13
// allocated block is zero-initialized. If allocation fails, nullptr is
14
// returned.
15
//
16
// This function supports patching and therefore must be marked noinline.
17
// Both _calloc_dbg and _calloc_base must also be marked noinline
18
// to prevent identical COMDAT folding from substituting calls to calloc
19
// with either other function or vice versa.
20
extern
"C"
_CRT_HYBRIDPATCHABLE
__declspec
(
noinline
)
_CRTRESTRICT
void
*
__cdecl
calloc
(
21
size_t
const
count
,
22
size_t
const
size
23
)
24
{
25
#ifdef _DEBUG
26
return
_calloc_dbg
(
count
,
size
,
_NORMAL_BLOCK
,
nullptr
, 0);
27
#else
28
return
_calloc_base(
count
,
size
);
29
#endif
30
}
__cdecl
#define __cdecl
Definition:
accygwin.h:79
corecrt_internal.h
_CRTRESTRICT
#define _CRTRESTRICT
Definition:
corecrt.h:17
_NORMAL_BLOCK
#define _NORMAL_BLOCK
Definition:
crtdbg.h:67
_calloc_dbg
#define _calloc_dbg(c, s, t, f, l)
Definition:
crtdbg.h:205
noinline
#define noinline
Definition:
types.h:64
__declspec
void __declspec(noinline) __cdecl _free_base(void *const block)
Definition:
free_base.cpp:98
count
GLuint GLuint GLsizei count
Definition:
gl.h:1545
size
GLsizeiptr size
Definition:
glext.h:5919
calloc
#define calloc
Definition:
rosglue.h:14
_CRT_HYBRIDPATCHABLE
#define _CRT_HYBRIDPATCHABLE
Definition:
corecrt.h:188
sdk
lib
ucrt
heap
calloc.cpp
Generated on Thu Dec 4 2025 06:16:18 for ReactOS by
1.9.6