From 4210cafc04535a3ad0e3c4c16d1c5c20d1fab488 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 7 Dec 2007 23:42:22 +0100 Subject: [PATCH] riched20: Rename the wrappers around HeapAlloc() &Co to use the new standard naming. --- dlls/riched20/clipboard.c | 8 ++++---- dlls/riched20/editor.c | 13 +++++++------ dlls/riched20/editor.h | 12 ++++++------ dlls/riched20/reader.c | 6 +++--- dlls/riched20/richole.c | 4 ++-- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/dlls/riched20/clipboard.c b/dlls/riched20/clipboard.c index 376a2e5b3d9..e9b5cd0ef55 100644 --- a/dlls/riched20/clipboard.c +++ b/dlls/riched20/clipboard.c @@ -77,7 +77,7 @@ static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface) if(!ref) { GlobalFree(This->fmtetc); - richedit_free(This); + heap_free(This); } return ref; @@ -152,7 +152,7 @@ static HRESULT EnumFormatImpl_Create(const FORMATETC *fmtetc, UINT fmtetc_cnt, I EnumFormatImpl *ret; TRACE("\n"); - ret = richedit_alloc(sizeof(EnumFormatImpl)); + ret = heap_alloc(sizeof(EnumFormatImpl)); ret->lpVtbl = &VT_EnumFormatImpl; ret->ref = 1; ret->cur = 0; @@ -195,7 +195,7 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface) if(This->unicode) GlobalFree(This->unicode); if(This->rtf) GlobalFree(This->rtf); if(This->fmtetc) GlobalFree(This->fmtetc); - richedit_free(This); + heap_free(This); } return ref; @@ -388,7 +388,7 @@ HRESULT ME_GetDataObject(ME_TextEditor *editor, const CHARRANGE *lpchrg, LPDATAO DataObjectImpl *obj; TRACE("(%p,%d,%d)\n", editor, lpchrg->cpMin, lpchrg->cpMax); - obj = richedit_alloc(sizeof(DataObjectImpl)); + obj = heap_alloc(sizeof(DataObjectImpl)); if(cfRTF == 0) cfRTF = RegisterClipboardFormatA("Rich Text Format"); diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index d30ba9de412..10aaaa9b959 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2013,8 +2013,9 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, LPWSTR bufferW = NULL; if (unicode) - bufferW = richedit_alloc((wParam + 2) * sizeof(WCHAR)); - else bufferA = richedit_alloc(wParam + 2); + bufferW = heap_alloc((wParam + 2) * sizeof(WCHAR)); + else + bufferA = heap_alloc(wParam + 2); ex.cb = wParam + (unicode ? 2*sizeof(WCHAR) : 2); ex.flags = GT_USECRLF; @@ -2033,8 +2034,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, memcpy((LPSTR)lParam, bufferA, wParam); if (strlen(bufferA) >= wParam) rc = 0; } - if (bufferA != NULL) richedit_free(bufferA); - if (bufferW != NULL) richedit_free(bufferW); + heap_free(bufferA); + heap_free(bufferW); return rc; } case EM_GETTEXTEX: @@ -2066,7 +2067,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, /* potentially each char may be a CR, why calculate the exact value with O(N) when we can just take a bigger buffer? :) */ int crlfmul = (ex->flags & GT_USECRLF) ? 2 : 1; - LPWSTR buffer = richedit_alloc((crlfmul*nCount + 1) * sizeof(WCHAR)); + LPWSTR buffer = heap_alloc((crlfmul*nCount + 1) * sizeof(WCHAR)); DWORD buflen = ex->cb; LRESULT rc; DWORD flags = 0; @@ -2075,7 +2076,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, rc = WideCharToMultiByte(ex->codepage, flags, buffer, -1, (LPSTR)lParam, ex->cb, ex->lpDefaultChar, ex->lpUsedDefaultChar); if (rc) rc--; /* do not count 0 terminator */ - richedit_free(buffer); + heap_free(buffer); return rc; } } diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 83dee767847..010494aa88b 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -23,24 +23,24 @@ extern HANDLE me_heap; -static inline void *richedit_alloc( size_t len ) +static inline void *heap_alloc( size_t len ) { return HeapAlloc( me_heap, 0, len ); } -static inline BOOL richedit_free( void *ptr ) +static inline BOOL heap_free( void *ptr ) { return HeapFree( me_heap, 0, ptr ); } -static inline void *richedit_realloc( void *ptr, size_t len ) +static inline void *heap_realloc( void *ptr, size_t len ) { return HeapReAlloc( me_heap, 0, ptr, len ); } -#define ALLOC_OBJ(type) richedit_alloc(sizeof(type)) -#define ALLOC_N_OBJ(type, count) richedit_alloc((count)*sizeof(type)) -#define FREE_OBJ(ptr) richedit_free(ptr) +#define ALLOC_OBJ(type) heap_alloc(sizeof(type)) +#define ALLOC_N_OBJ(type, count) heap_alloc((count)*sizeof(type)) +#define FREE_OBJ(ptr) heap_free(ptr) #define RUN_IS_HIDDEN(run) ((run)->style->fmt.dwMask & CFM_HIDDEN \ && (run)->style->fmt.dwEffects & CFE_HIDDEN) diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c index e0a9e1a86e3..de8cadd1f2a 100644 --- a/dlls/riched20/reader.c +++ b/dlls/riched20/reader.c @@ -85,9 +85,9 @@ static void RTFPutCodePageChar(RTF_Info *info, int c); * Return pointer to block of size bytes, or NULL if there's * not enough memory available. */ -#define RTFAlloc(size) richedit_alloc(size) -#define RTFReAlloc(ptr, size) richedit_realloc(ptr, size) -#define RTFFree(ptr) richedit_free(ptr) +#define RTFAlloc(size) heap_alloc(size) +#define RTFReAlloc(ptr, size) heap_realloc(ptr, size) +#define RTFFree(ptr) heap_free(ptr) /* * Saves a string on the heap and returns a pointer to it. diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index 0585e43edf8..9bd44aaee4e 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -112,7 +112,7 @@ IRichEditOle_fnRelease(IRichEditOle *me) if (!ref) { TRACE ("Destroying %p\n", This); - richedit_free(This); + heap_free(This); } return ref; } @@ -529,7 +529,7 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj) { IRichEditOleImpl *reo; - reo = richedit_alloc(sizeof(IRichEditOleImpl)); + reo = heap_alloc(sizeof(IRichEditOleImpl)); if (!reo) return 0;