Michael Stefaniuc : riched20: Get rid of the ALLOC_OBJ macro.
Alexandre Julliard
julliard at winehq.org
Mon Feb 5 16:48:26 CST 2018
Module: wine
Branch: master
Commit: 965dc38175fdeef4a674b17977c5ad77d2e9d660
URL: https://source.winehq.org/git/wine.git/?a=commit;h=965dc38175fdeef4a674b17977c5ad77d2e9d660
Author: Michael Stefaniuc <mstefani at winehq.org>
Date: Sat Feb 3 23:59:47 2018 +0100
riched20: Get rid of the ALLOC_OBJ macro.
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/caret.c | 2 +-
dlls/riched20/editor.c | 14 ++++----------
dlls/riched20/editor.h | 1 -
dlls/riched20/list.c | 4 ++--
dlls/riched20/style.c | 2 +-
dlls/riched20/table.c | 4 ++--
dlls/riched20/writer.c | 8 ++------
7 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 8a99394..d676a1b 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -484,7 +484,7 @@ void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCur
di = ME_InternalInsertTextFromCursor(editor, nCursor, &space, 1, pStyle,
MERF_GRAPHICS);
- di->member.run.ole_obj = ALLOC_OBJ(*reo);
+ di->member.run.ole_obj = heap_alloc(sizeof(*reo));
ME_CopyReObject(di->member.run.ole_obj, reo);
ME_ReleaseStyle(pStyle);
}
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index da7d62b..53d0950 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -261,9 +261,7 @@ static inline BOOL is_version_nt(void)
}
static ME_TextBuffer *ME_MakeText(void) {
-
- ME_TextBuffer *buf = ALLOC_OBJ(ME_TextBuffer);
-
+ ME_TextBuffer *buf = heap_alloc(sizeof(*buf));
ME_DisplayItem *p1 = ME_MakeDI(diTextStart);
ME_DisplayItem *p2 = ME_MakeDI(diTextEnd);
@@ -606,8 +604,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
if (!info->editor->bEmulateVersion10) /* v4.1 */
{
while (info->rtfParam > info->nestingLevel) {
- RTFTable *tableDef = ALLOC_OBJ(RTFTable);
- ZeroMemory(tableDef, sizeof(RTFTable));
+ RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
tableDef->parent = info->tableDef;
info->tableDef = tableDef;
@@ -641,10 +638,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
{
RTFTable *tableDef;
if (!info->tableDef)
- {
- info->tableDef = ALLOC_OBJ(RTFTable);
- ZeroMemory(info->tableDef, sizeof(RTFTable));
- }
+ info->tableDef = heap_alloc_zero(sizeof(*info->tableDef));
tableDef = info->tableDef;
RTFFlushOutputBuffer(info);
if (tableDef->tableRowStart &&
@@ -2993,7 +2987,7 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
{
- ME_TextEditor *ed = ALLOC_OBJ(ME_TextEditor);
+ ME_TextEditor *ed = heap_alloc(sizeof(*ed));
int i;
DWORD props;
LONG selbarwidth;
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 55e259a..6215068 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -25,7 +25,6 @@ struct _RTF_Info;
extern HANDLE me_heap DECLSPEC_HIDDEN;
-#define ALLOC_OBJ(type) heap_alloc(sizeof(type))
#define ALLOC_N_OBJ(type, count) heap_alloc((count)*sizeof(type))
#define RUN_IS_HIDDEN(run) ((run)->style->fmt.dwMask & CFM_HIDDEN \
diff --git a/dlls/riched20/list.c b/dlls/riched20/list.c
index 7cb9927..58b64e8 100644
--- a/dlls/riched20/list.c
+++ b/dlls/riched20/list.c
@@ -179,8 +179,8 @@ void ME_DestroyDisplayItem(ME_DisplayItem *item)
ME_DisplayItem *ME_MakeDI(ME_DIType type)
{
- ME_DisplayItem *item = ALLOC_OBJ(ME_DisplayItem);
- ZeroMemory(item, sizeof(ME_DisplayItem));
+ ME_DisplayItem *item = heap_alloc_zero(sizeof(*item));
+
item->type = type;
item->prev = item->next = NULL;
return item;
diff --git a/dlls/riched20/style.c b/dlls/riched20/style.c
index 5462580..48d57e8 100644
--- a/dlls/riched20/style.c
+++ b/dlls/riched20/style.c
@@ -113,7 +113,7 @@ void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
ME_Style *ME_MakeStyle(CHARFORMAT2W *style)
{
- ME_Style *s = ALLOC_OBJ(ME_Style);
+ ME_Style *s = heap_alloc(sizeof(*s));
assert(style->cbSize == sizeof(CHARFORMAT2W));
s->fmt = *style;
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index d2cab9a..4cd77eb 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -637,8 +637,8 @@ void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor)
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor)
{
- RTFTable *tableDef = ALLOC_OBJ(RTFTable);
- ZeroMemory(tableDef, sizeof(RTFTable));
+ RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
+
if (!editor->bEmulateVersion10) /* v4.1 */
tableDef->gapH = 10;
return tableDef;
diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c
index de0bb8d..aad2e44 100644
--- a/dlls/riched20/writer.c
+++ b/dlls/riched20/writer.c
@@ -57,15 +57,11 @@ ME_StreamOutRTFText(ME_OutStream *pStream, const WCHAR *text, LONG nChars);
static ME_OutStream*
ME_StreamOutInit(ME_TextEditor *editor, EDITSTREAM *stream)
{
- ME_OutStream *pStream = ALLOC_OBJ(ME_OutStream);
+ ME_OutStream *pStream = heap_alloc_zero(sizeof(*pStream));
+
pStream->stream = stream;
pStream->stream->dwError = 0;
- pStream->pos = 0;
- pStream->written = 0;
- pStream->nFontTblLen = 0;
pStream->nColorTblLen = 1;
- pStream->nNestingLevel = 0;
- memset(&pStream->cur_fmt, 0, sizeof(pStream->cur_fmt));
pStream->cur_fmt.dwEffects = CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR;
pStream->cur_fmt.bUnderlineType = CFU_UNDERLINE;
return pStream;
More information about the wine-cvs
mailing list