Michael Stefaniuc : riched20: Get rid of the ALLOC_N_OBJ macro.

Alexandre Julliard julliard at winehq.org
Mon Feb 5 16:48:26 CST 2018


Module: wine
Branch: master
Commit: c03b41c8960335dbe4dfefb1118da872328c5b57
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c03b41c8960335dbe4dfefb1118da872328c5b57

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Sat Feb  3 23:59:48 2018 +0100

riched20: Get rid of the ALLOC_N_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/editor.c | 8 ++++----
 dlls/riched20/editor.h | 2 --
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 53d0950..c442512 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2136,7 +2136,7 @@ static int ME_GetTextRange(ME_TextEditor *editor, WCHAR *strText,
       return ME_GetTextW(editor, strText, INT_MAX, start, nLen, FALSE, FALSE);
     } else {
       int nChars;
-      WCHAR *p = ALLOC_N_OBJ(WCHAR, nLen+1);
+      WCHAR *p = heap_alloc((nLen+1) * sizeof(*p));
       if (!p) return 0;
       nChars = ME_GetTextW(editor, p, nLen, start, nLen, FALSE, FALSE);
       WideCharToMultiByte(CP_ACP, 0, p, nChars+1, (char *)strText,
@@ -3021,7 +3021,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
    * or paragraph selection.
    */
   ed->nCursors = 4;
-  ed->pCursors = ALLOC_N_OBJ(ME_Cursor, ed->nCursors);
+  ed->pCursors = heap_alloc(ed->nCursors * sizeof(*ed->pCursors));
   ME_SetCursorToStart(ed, &ed->pCursors[0]);
   ed->pCursors[1] = ed->pCursors[0];
   ed->pCursors[2] = ed->pCursors[0];
@@ -4295,7 +4295,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
       int nChars = MultiByteToWideChar(CP_ACP, 0, ft->lpstrText, -1, NULL, 0);
       WCHAR *tmp;
 
-      if ((tmp = ALLOC_N_OBJ(WCHAR, nChars)) != NULL)
+      if ((tmp = heap_alloc(nChars * sizeof(*tmp))) != NULL)
         MultiByteToWideChar(CP_ACP, 0, ft->lpstrText, -1, tmp, nChars);
       r = ME_FindText(editor, wParam, &ft->chrg, tmp, NULL);
       heap_free(tmp);
@@ -4313,7 +4313,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
       int nChars = MultiByteToWideChar(CP_ACP, 0, ex->lpstrText, -1, NULL, 0);
       WCHAR *tmp;
 
-      if ((tmp = ALLOC_N_OBJ(WCHAR, nChars)) != NULL)
+      if ((tmp = heap_alloc(nChars * sizeof(*tmp))) != NULL)
         MultiByteToWideChar(CP_ACP, 0, ex->lpstrText, -1, tmp, nChars);
       r = ME_FindText(editor, wParam, &ex->chrg, tmp, &ex->chrgText);
       heap_free(tmp);
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 6215068..0db5326 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -25,8 +25,6 @@ struct _RTF_Info;
 
 extern HANDLE me_heap DECLSPEC_HIDDEN;
 
-#define ALLOC_N_OBJ(type, count) heap_alloc((count)*sizeof(type))
-
 #define RUN_IS_HIDDEN(run) ((run)->style->fmt.dwMask & CFM_HIDDEN \
                              && (run)->style->fmt.dwEffects & CFE_HIDDEN)
 




More information about the wine-cvs mailing list