vbscript | include: Make the heap_alloc wrappers global.

Michael Stefaniuc mstefani at redhat.de
Fri Feb 8 04:33:39 CST 2013


---
 dlls/vbscript/vbscript.h |   21 +---------------
 include/Makefile.in      |    1 +
 include/wine/heap.h      |   60 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 20 deletions(-)
 create mode 100644 include/wine/heap.h

diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h
index 2ce93b6..917b914 100644
--- a/dlls/vbscript/vbscript.h
+++ b/dlls/vbscript/vbscript.h
@@ -28,6 +28,7 @@
 
 #include "vbscript_classes.h"
 
+#include "wine/heap.h"
 #include "wine/list.h"
 #include "wine/unicode.h"
 
@@ -360,26 +361,6 @@ HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,vo
 
 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
 
-static inline void *heap_alloc(size_t len)
-{
-    return HeapAlloc(GetProcessHeap(), 0, len);
-}
-
-static inline void *heap_alloc_zero(size_t len)
-{
-    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
-}
-
-static inline void *heap_realloc(void *mem, size_t len)
-{
-    return HeapReAlloc(GetProcessHeap(), 0, mem, len);
-}
-
-static inline BOOL heap_free(void *mem)
-{
-    return HeapFree(GetProcessHeap(), 0, mem);
-}
-
 static inline LPWSTR heap_strdupW(LPCWSTR str)
 {
     LPWSTR ret = NULL;
diff --git a/include/Makefile.in b/include/Makefile.in
index ace89bb..9c8d783 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -551,6 +551,7 @@ SRCDIR_INCLUDES = \
 	windowsx.h \
 	wine/debug.h \
 	wine/exception.h \
+	wine/heap.h \
 	wine/library.h \
 	wine/unicode.h \
 	winerror.h \
diff --git a/include/wine/heap.h b/include/wine/heap.h
new file mode 100644
index 0000000..c120784
--- /dev/null
+++ b/include/wine/heap.h
@@ -0,0 +1,60 @@
+/*
+ * Wine heap memory allocation wrappers
+ *
+ * Copyright 2006 Jacek Caban for CodeWeavers
+ * Copyright 2013 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 <windef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+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)
+{
+    return HeapReAlloc(GetProcessHeap(), 0, mem, len);
+}
+
+static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
+{
+    return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
+}
+
+static inline BOOL heap_free(void *mem)
+{
+    return HeapFree(GetProcessHeap(), 0, mem);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __WINE_WINE_HEAP_H */
-- 
1.7.7.6



More information about the wine-patches mailing list