gdiplus: Use helper function for HeapReAlloc calls.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2015-10-21 00:53:31 +02:00 committed by Alexandre Julliard
parent ff1b209be8
commit 1250af4986
3 changed files with 9 additions and 5 deletions

View File

@ -420,12 +420,10 @@ BOOL lengthen_path(GpPath *path, INT len)
while(path->datalen - path->pathdata.Count < len) while(path->datalen - path->pathdata.Count < len)
path->datalen *= 2; path->datalen *= 2;
path->pathdata.Points = HeapReAlloc(GetProcessHeap(), 0, path->pathdata.Points = heap_realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
path->pathdata.Points, path->datalen * sizeof(PointF));
if(!path->pathdata.Points) return FALSE; if(!path->pathdata.Points) return FALSE;
path->pathdata.Types = HeapReAlloc(GetProcessHeap(), 0, path->pathdata.Types = heap_realloc(path->pathdata.Types, path->datalen);
path->pathdata.Types, path->datalen);
if(!path->pathdata.Types) return FALSE; if(!path->pathdata.Types) return FALSE;
} }

View File

@ -60,6 +60,12 @@ static inline void *heap_alloc_zero(size_t len)
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 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) static inline BOOL heap_free(void *mem)
{ {
return HeapFree(GetProcessHeap(), 0, mem); return HeapFree(GetProcessHeap(), 0, mem);

View File

@ -291,7 +291,7 @@ GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL fir
/* reallocation */ /* reallocation */
if((format->tabcount < count) && (format->tabcount > 0)){ if((format->tabcount < count) && (format->tabcount > 0)){
REAL *ptr; REAL *ptr;
ptr = HeapReAlloc(GetProcessHeap(), 0, format->tabs, sizeof(REAL)*count); ptr = heap_realloc(format->tabs, sizeof(REAL)*count);
if(!ptr) if(!ptr)
return OutOfMemory; return OutOfMemory;
format->tabs = ptr; format->tabs = ptr;