[PATCH 3/5] usp10: Use heap_alloc_zero() instead of HeapAlloc() with HEAP_ZERO_MEMORY.
Henri Verbeet
hverbeet at codeweavers.com
Thu Mar 9 03:37:06 CST 2017
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
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 3bbf5ec..6d6a25e 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 8a8a62f..a1be308 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 989620d..a0637dd 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 void heap_free(void *mem)
+{
+ HeapFree(GetProcessHeap(), 0, mem);
+}
+
static inline BOOL is_consonant( int type )
{
return (type == lex_Ra || type == lex_Consonant);
--
2.1.4
More information about the wine-patches
mailing list