Sebastian Lackner : gdiplus: Use helper function for HeapReAlloc calls.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Oct 29 09:32:11 CDT 2015


Module: wine
Branch: master
Commit: 1250af4986c6d9ebb6a26726db09f2ffe818d209
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1250af4986c6d9ebb6a26726db09f2ffe818d209

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Wed Oct 21 00:53:31 2015 +0200

gdiplus: Use helper function for HeapReAlloc calls.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/gdiplus.c         | 6 ++----
 dlls/gdiplus/gdiplus_private.h | 6 ++++++
 dlls/gdiplus/stringformat.c    | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c
index 32f20d8..1281455 100644
--- a/dlls/gdiplus/gdiplus.c
+++ b/dlls/gdiplus/gdiplus.c
@@ -420,12 +420,10 @@ BOOL lengthen_path(GpPath *path, INT len)
         while(path->datalen - path->pathdata.Count < len)
             path->datalen *= 2;
 
-        path->pathdata.Points = HeapReAlloc(GetProcessHeap(), 0,
-            path->pathdata.Points, path->datalen * sizeof(PointF));
+        path->pathdata.Points = heap_realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
         if(!path->pathdata.Points)  return FALSE;
 
-        path->pathdata.Types = HeapReAlloc(GetProcessHeap(), 0,
-            path->pathdata.Types, path->datalen);
+        path->pathdata.Types = heap_realloc(path->pathdata.Types, path->datalen);
         if(!path->pathdata.Types)   return FALSE;
     }
 
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index d0faac2..1af0bd0 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -60,6 +60,12 @@ static inline void *heap_alloc_zero(size_t len)
     return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
 }
 
+static void *heap_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2);
+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);
diff --git a/dlls/gdiplus/stringformat.c b/dlls/gdiplus/stringformat.c
index 8791ceb..b89458b 100644
--- a/dlls/gdiplus/stringformat.c
+++ b/dlls/gdiplus/stringformat.c
@@ -291,7 +291,7 @@ GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL fir
         /* reallocation */
         if((format->tabcount < count) && (format->tabcount > 0)){
             REAL *ptr;
-            ptr = HeapReAlloc(GetProcessHeap(), 0, format->tabs, sizeof(REAL)*count);
+            ptr = heap_realloc(format->tabs, sizeof(REAL)*count);
             if(!ptr)
                 return OutOfMemory;
             format->tabs = ptr;




More information about the wine-cvs mailing list