diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 8a99394dcb6..d676a1bc38b 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 da7d62b095e..53d0950bd49 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 55e259afb2f..6215068cdd4 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 7cb99277125..58b64e8081d 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 546258027c5..48d57e8b43c 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 d2cab9a817c..4cd77eb3996 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 de0bb8d72f4..aad2e448796 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;