https://git.reactos.org/?p=reactos.git;a=commitdiff;h=004d830fe974f3ade31bb…
commit 004d830fe974f3ade31bb3fe31d5ec186f7486d9
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Sun Mar 4 13:10:02 2018 +0100
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sun Mar 4 13:10:02 2018 +0100
[INCLUDE/WINE] Import heap.h from Wine Staging 3.3. CORE-14434
---
sdk/include/reactos/wine/heap.h | 58 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/sdk/include/reactos/wine/heap.h b/sdk/include/reactos/wine/heap.h
new file mode 100644
index 0000000000..97d3a5662b
--- /dev/null
+++ b/sdk/include/reactos/wine/heap.h
@@ -0,0 +1,58 @@
+/*
+ * Wine heap memory allocation wrappers
+ *
+ * Copyright 2006 Jacek Caban for CodeWeavers
+ * Copyright 2013, 2018 Michael Stefaniuc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_WINE_HEAP_H
+#define __WINE_WINE_HEAP_H
+
+#include <winbase.h>
+
+static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(SIZE_T len)
+{
+ return HeapAlloc(GetProcessHeap(), 0, len);
+}
+
+static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(SIZE_T len)
+{
+ return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+}
+
+static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, SIZE_T len)
+{
+ if (!mem)
+ return HeapAlloc(GetProcessHeap(), 0, len);
+ return HeapReAlloc(GetProcessHeap(), 0, mem, len);
+}
+
+static inline void heap_free(void *mem)
+{
+ HeapFree(GetProcessHeap(), 0, mem);
+}
+
+static inline void *heap_calloc(SIZE_T count, SIZE_T size)
+{
+ SIZE_T len = count * size;
+
+ if (size && len / size != count)
+ return NULL;
+ return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+}
+
+#endif /* __WINE_WINE_HEAP_H */