From 77e5a2fba9c89a7c33fb2e2790c2433f4fdd928a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 9 Mar 2017 10:37:06 +0100 Subject: [PATCH] usp10: Use heap_alloc_zero() instead of HeapAlloc() with HEAP_ZERO_MEMORY. Signed-off-by: Henri Verbeet Signed-off-by: Aric Stewart Signed-off-by: Alexandre Julliard --- dlls/usp10/opentype.c | 8 ++++---- dlls/usp10/usp10.c | 15 --------------- dlls/usp10/usp10_internal.h | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/dlls/usp10/opentype.c b/dlls/usp10/opentype.c index 3bbf5ec5a23..6d6a25e2b2d 100644 --- a/dlls/usp10/opentype.c +++ b/dlls/usp10/opentype.c @@ -2472,7 +2472,7 @@ static void GSUB_initialize_script_cache(ScriptCache *psc) TRACE("initializing %i scripts in this font\n",psc->script_count); if (psc->script_count) { - psc->scripts = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LoadedScript) * psc->script_count); + psc->scripts = heap_alloc_zero(psc->script_count * sizeof(*psc->scripts)); for (i = 0; i < psc->script_count; i++) { int offset = GET_BE_WORD(script->ScriptRecord[i].Script); @@ -2504,7 +2504,7 @@ static void GPOS_expand_script_cache(ScriptCache *psc) TRACE("initializing %i scripts in this font\n",psc->script_count); if (psc->script_count) { - psc->scripts = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LoadedScript) * psc->script_count); + psc->scripts = heap_alloc_zero(psc->script_count * sizeof(*psc->scripts)); for (i = 0; i < psc->script_count; i++) { int offset = GET_BE_WORD(script->ScriptRecord[i].Script); @@ -2602,7 +2602,7 @@ static void GSUB_initialize_language_cache(LoadedScript *script) { TRACE("Deflang %p, LangCount %i\n",script->default_language.gsub_table, script->language_count); - script->languages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LoadedLanguage) * script->language_count); + script->languages = heap_alloc_zero(script->language_count * sizeof(*script->languages)); for (i = 0; i < script->language_count; i++) { @@ -2639,7 +2639,7 @@ static void GPOS_expand_language_cache(LoadedScript *script) int i; script->language_count = count; - script->languages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LoadedLanguage) * script->language_count); + script->languages = heap_alloc_zero(script->language_count * sizeof(*script->languages)); for (i = 0; i < script->language_count; i++) { diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 8a8a62f82b8..a1be308dbfa 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -708,21 +708,6 @@ typedef struct { WORD target; } FindGlyph_struct; -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) -{ - return HeapAlloc(GetProcessHeap(), 0, size); -} - -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size) -{ - return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); -} - -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} - /* TODO Fix font properties on Arabic locale */ static inline BOOL set_cache_font_properties(const HDC hdc, ScriptCache *sc) { diff --git a/dlls/usp10/usp10_internal.h b/dlls/usp10/usp10_internal.h index 989620d0c76..fa9b6c2bead 100644 --- a/dlls/usp10/usp10_internal.h +++ b/dlls/usp10/usp10_internal.h @@ -212,6 +212,21 @@ typedef struct { enum {lex_Halant, lex_Composed_Vowel, lex_Matra_post, lex_Matra_pre, lex_Matra_above, lex_Matra_below, lex_ZWJ, lex_ZWNJ, lex_NBSP, lex_Modifier, lex_Vowel, lex_Consonant, lex_Generic, lex_Ra, lex_Vedic, lex_Anudatta, lex_Nukta}; +static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) +{ + return HeapAlloc(GetProcessHeap(), 0, size); +} + +static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size) +{ + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); +} + +static inline BOOL heap_free(void *mem) +{ + return HeapFree(GetProcessHeap(), 0, mem); +} + static inline BOOL is_consonant( int type ) { return (type == lex_Ra || type == lex_Consonant);