riched20: Get rid of the ALLOC_OBJ macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-02-03 23:59:47 +01:00 committed by Alexandre Julliard
parent 7153b5593e
commit 965dc38175
7 changed files with 12 additions and 23 deletions

View File

@ -484,7 +484,7 @@ void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCur
di = ME_InternalInsertTextFromCursor(editor, nCursor, &space, 1, pStyle, di = ME_InternalInsertTextFromCursor(editor, nCursor, &space, 1, pStyle,
MERF_GRAPHICS); 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_CopyReObject(di->member.run.ole_obj, reo);
ME_ReleaseStyle(pStyle); ME_ReleaseStyle(pStyle);
} }

View File

@ -261,9 +261,7 @@ static inline BOOL is_version_nt(void)
} }
static ME_TextBuffer *ME_MakeText(void) { static ME_TextBuffer *ME_MakeText(void) {
ME_TextBuffer *buf = heap_alloc(sizeof(*buf));
ME_TextBuffer *buf = ALLOC_OBJ(ME_TextBuffer);
ME_DisplayItem *p1 = ME_MakeDI(diTextStart); ME_DisplayItem *p1 = ME_MakeDI(diTextStart);
ME_DisplayItem *p2 = ME_MakeDI(diTextEnd); ME_DisplayItem *p2 = ME_MakeDI(diTextEnd);
@ -606,8 +604,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
if (!info->editor->bEmulateVersion10) /* v4.1 */ if (!info->editor->bEmulateVersion10) /* v4.1 */
{ {
while (info->rtfParam > info->nestingLevel) { while (info->rtfParam > info->nestingLevel) {
RTFTable *tableDef = ALLOC_OBJ(RTFTable); RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
ZeroMemory(tableDef, sizeof(RTFTable));
tableDef->parent = info->tableDef; tableDef->parent = info->tableDef;
info->tableDef = tableDef; info->tableDef = tableDef;
@ -641,10 +638,7 @@ void ME_RTFParAttrHook(RTF_Info *info)
{ {
RTFTable *tableDef; RTFTable *tableDef;
if (!info->tableDef) if (!info->tableDef)
{ info->tableDef = heap_alloc_zero(sizeof(*info->tableDef));
info->tableDef = ALLOC_OBJ(RTFTable);
ZeroMemory(info->tableDef, sizeof(RTFTable));
}
tableDef = info->tableDef; tableDef = info->tableDef;
RTFFlushOutputBuffer(info); RTFFlushOutputBuffer(info);
if (tableDef->tableRowStart && 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 *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
{ {
ME_TextEditor *ed = ALLOC_OBJ(ME_TextEditor); ME_TextEditor *ed = heap_alloc(sizeof(*ed));
int i; int i;
DWORD props; DWORD props;
LONG selbarwidth; LONG selbarwidth;

View File

@ -25,7 +25,6 @@ struct _RTF_Info;
extern HANDLE me_heap DECLSPEC_HIDDEN; 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 ALLOC_N_OBJ(type, count) heap_alloc((count)*sizeof(type))
#define RUN_IS_HIDDEN(run) ((run)->style->fmt.dwMask & CFM_HIDDEN \ #define RUN_IS_HIDDEN(run) ((run)->style->fmt.dwMask & CFM_HIDDEN \

View File

@ -179,8 +179,8 @@ void ME_DestroyDisplayItem(ME_DisplayItem *item)
ME_DisplayItem *ME_MakeDI(ME_DIType type) ME_DisplayItem *ME_MakeDI(ME_DIType type)
{ {
ME_DisplayItem *item = ALLOC_OBJ(ME_DisplayItem); ME_DisplayItem *item = heap_alloc_zero(sizeof(*item));
ZeroMemory(item, sizeof(ME_DisplayItem));
item->type = type; item->type = type;
item->prev = item->next = NULL; item->prev = item->next = NULL;
return item; return item;

View File

@ -113,7 +113,7 @@ void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
ME_Style *ME_MakeStyle(CHARFORMAT2W *style) 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)); assert(style->cbSize == sizeof(CHARFORMAT2W));
s->fmt = *style; s->fmt = *style;

View File

@ -637,8 +637,8 @@ void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor)
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor)
{ {
RTFTable *tableDef = ALLOC_OBJ(RTFTable); RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
ZeroMemory(tableDef, sizeof(RTFTable));
if (!editor->bEmulateVersion10) /* v4.1 */ if (!editor->bEmulateVersion10) /* v4.1 */
tableDef->gapH = 10; tableDef->gapH = 10;
return tableDef; return tableDef;

View File

@ -57,15 +57,11 @@ ME_StreamOutRTFText(ME_OutStream *pStream, const WCHAR *text, LONG nChars);
static ME_OutStream* static ME_OutStream*
ME_StreamOutInit(ME_TextEditor *editor, EDITSTREAM *stream) 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 = stream;
pStream->stream->dwError = 0; pStream->stream->dwError = 0;
pStream->pos = 0;
pStream->written = 0;
pStream->nFontTblLen = 0;
pStream->nColorTblLen = 1; 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.dwEffects = CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR;
pStream->cur_fmt.bUnderlineType = CFU_UNDERLINE; pStream->cur_fmt.bUnderlineType = CFU_UNDERLINE;
return pStream; return pStream;