OLD | NEW |
| (Empty) |
1 //========================================== | |
2 // LIBCTINY - Matt Pietrek 2001 | |
3 // MSDN Magazine, January 2001 | |
4 //========================================== | |
5 #include "libctiny.h" | |
6 #include <windows.h> | |
7 #include <malloc.h> | |
8 | |
9 extern "C" | |
10 #if _MSC_VER >= 1400 | |
11 __declspec(noalias restrict) | |
12 #endif | |
13 void * __cdecl realloc(void * p, size_t size) { | |
14 if (p) | |
15 return HeapReAlloc( GetProcessHeap(), 0, p, size ); | |
16 else // 'p' is 0, and HeapReAlloc doesn't act like realloc() here | |
17 return HeapAlloc( GetProcessHeap(), 0, size ); | |
18 } | |
19 | |
20 extern "C" | |
21 #if _MSC_VER >= 1400 | |
22 __declspec(noalias restrict) | |
23 #endif | |
24 void * __cdecl calloc(size_t nitems, size_t size) { | |
25 return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, nitems * size ); | |
26 } | |
27 | |
28 extern "C" | |
29 #if _MSC_VER >= 1400 | |
30 __declspec(noalias restrict) | |
31 #endif | |
32 void * __cdecl _recalloc(void * p, size_t nitems, size_t size) { | |
33 return realloc(p, nitems * size); | |
34 } | |
35 | |
OLD | NEW |