ReactOS  0.4.12-dev-18-gf469aca
heap.h
Go to the documentation of this file.
1 /*
2  * Wine heap memory allocation wrappers
3  *
4  * Copyright 2006 Jacek Caban for CodeWeavers
5  * Copyright 2013, 2018 Michael Stefaniuc
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #ifndef __WINE_WINE_HEAP_H
23 #define __WINE_WINE_HEAP_H
24 
25 #include <winbase.h>
26 
27 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(SIZE_T len)
28 {
29  return HeapAlloc(GetProcessHeap(), 0, len);
30 }
31 
32 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(SIZE_T len)
33 {
35 }
36 
37 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, SIZE_T len)
38 {
39  if (!mem)
40  return HeapAlloc(GetProcessHeap(), 0, len);
41  return HeapReAlloc(GetProcessHeap(), 0, mem, len);
42 }
43 
44 static inline void heap_free(void *mem)
45 {
46  HeapFree(GetProcessHeap(), 0, mem);
47 }
48 
49 static inline void *heap_calloc(SIZE_T count, SIZE_T size)
50 {
51  SIZE_T len = count * size;
52 
53  if (size && len / size != count)
54  return NULL;
56 }
57 
58 #endif /* __WINE_WINE_HEAP_H */
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static void heap_free(void *mem)
Definition: heap.h:44
smooth NULL
Definition: ftsmooth.c:416
static void * __WINE_ALLOC_SIZE(1) heap_alloc(SIZE_T len)
Definition: heap.h:27
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLsizei len
Definition: glext.h:6722
ULONG_PTR SIZE_T
Definition: typedefs.h:78
return HeapReAlloc(GetProcessHeap(), 0, mem, len)
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: mem.c:156
#define HeapFree(x, y, z)
Definition: compat.h:394