Module: wine Branch: master Commit: 58e62fff585fc27c7590bee103203c27710d0283 URL: https://gitlab.winehq.org/wine/wine/-/commit/58e62fff585fc27c7590bee103203c2... Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Sep 7 19:03:13 2023 -0600 oleview: Use CRT allocation functions. --- programs/oleview/pane.c | 6 +++--- programs/oleview/tree.c | 4 ++-- programs/oleview/typelib.c | 26 ++++++++++++-------------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/programs/oleview/pane.c b/programs/oleview/pane.c index 9e4cd283759..2465331ddc8 100644 --- a/programs/oleview/pane.c +++ b/programs/oleview/pane.c @@ -120,7 +120,7 @@ static LRESULT CALLBACK PaneProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa HIWORD(lParam), TRUE); break; case WM_DESTROY: - HeapFree(GetProcessHeap(), 0, pane); + free(pane); break; default: return DefWindowProcW(hWnd, uMsg, wParam, lParam); @@ -149,12 +149,12 @@ BOOL CreatePanedWindow(HWND hWnd, HWND *hWndCreated, HINSTANCE hInst) const WCHAR wszPaneClass[] = { 'P','A','N','E','\0' }; PANE *pane; - pane = HeapAlloc(GetProcessHeap(), 0, sizeof(PANE)); + pane = malloc(sizeof(PANE)); *hWndCreated = CreateWindowW(wszPaneClass, NULL, WS_CHILD|WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hWnd, (HMENU)pane, hInst, NULL); if(!*hWndCreated) { - HeapFree(GetProcessHeap(), 0, pane); + free(pane); return FALSE; } diff --git a/programs/oleview/tree.c b/programs/oleview/tree.c index b63a881a53f..e8f04322423 100644 --- a/programs/oleview/tree.c +++ b/programs/oleview/tree.c @@ -41,7 +41,7 @@ static LPARAM CreateITEM_INFO(INT flag, const WCHAR *info, const WCHAR *clsid, c { ITEM_INFO *reg; - reg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ITEM_INFO)); + reg = calloc(1, sizeof(ITEM_INFO)); reg->cFlag = flag; lstrcpyW(reg->info, info); @@ -651,7 +651,7 @@ static LRESULT CALLBACK TreeProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa { if (info->loaded) ReleaseInst(nm->itemOld.hItem); - HeapFree(GetProcessHeap(), 0, info); + free(info); } break; } diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c index e5e6b8f8f57..fd49cbd1782 100644 --- a/programs/oleview/typelib.c +++ b/programs/oleview/typelib.c @@ -124,13 +124,13 @@ static void SaveIdl(WCHAR *wszFileName) } len = WideCharToMultiByte( CP_UTF8, 0, data->idl, data->idlLen, NULL, 0, NULL, NULL ); - wszIdl = HeapAlloc(GetProcessHeap(), 0, len); + wszIdl = malloc(len); WideCharToMultiByte( CP_UTF8, 0, data->idl, data->idlLen, wszIdl, len, NULL, NULL ); if(!WriteFile(hFile, wszIdl, len, &dwNumWrite, NULL)) ShowLastError(); - HeapFree(GetProcessHeap(), 0, wszIdl); + free(wszIdl); CloseHandle(hFile); } @@ -183,8 +183,7 @@ static void AddToTLDataStrW(TYPELIB_DATA *pTLData, const WCHAR *wszSource) { int SourceLen = lstrlenW(wszSource); - pTLData->idl = HeapReAlloc(GetProcessHeap(), 0, pTLData->idl, - sizeof(WCHAR)*(pTLData->idlLen+SourceLen+1)); + pTLData->idl = realloc(pTLData->idl, sizeof(WCHAR) * (pTLData->idlLen + SourceLen + 1)); memcpy(&pTLData->idl[pTLData->idlLen], wszSource, sizeof(WCHAR)*(SourceLen+1)); pTLData->idlLen += SourceLen; @@ -205,8 +204,8 @@ static void AddToTLDataStrWithTabsW(TYPELIB_DATA *pTLData, WCHAR *wszSource) } if(*(pSourcePos - 1) != L'\n') newLinesNo++; - pTLData->idl = HeapReAlloc(GetProcessHeap(), 0, pTLData->idl, - sizeof(WCHAR)*(pTLData->idlLen+lineLen+4*newLinesNo+1)); + pTLData->idl = realloc(pTLData->idl, + sizeof(WCHAR) * (pTLData->idlLen + lineLen + 4 * newLinesNo + 1)); pSourcePos = wszSource; pSourceBeg = wszSource; @@ -244,9 +243,9 @@ static TYPELIB_DATA *InitializeTLData(void) { TYPELIB_DATA *pTLData; - pTLData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TYPELIB_DATA)); + pTLData = calloc(1, sizeof(TYPELIB_DATA)); - pTLData->idl = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)); + pTLData->idl = malloc(sizeof(WCHAR)); pTLData->idl[0] = '\0'; return pTLData; @@ -572,12 +571,11 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen AddToTLDataStrW(tld, wszAfter); } - bstrParamNames = HeapAlloc(GetProcessHeap(), 0, - sizeof(BSTR)*(pFuncDesc->cParams+1)); + bstrParamNames = malloc(sizeof(BSTR) * (pFuncDesc->cParams + 1)); if(FAILED(ITypeInfo_GetNames(pTypeInfo, pFuncDesc->memid, bstrParamNames, pFuncDesc->cParams+1, &namesNo))) { - HeapFree(GetProcessHeap(), 0, bstrParamNames); + free(bstrParamNames); continue; } SysFreeString(bstrParamNames[0]); @@ -660,7 +658,7 @@ static int EnumFuncs(ITypeInfo *pTypeInfo, TYPEATTR *pTypeAttr, HTREEITEM hParen AddToTLDataStrW(tld, L");\n"); SendMessageW(typelib.hTree, TVM_INSERTITEMW, 0, (LPARAM)&tvis); - HeapFree(GetProcessHeap(), 0, bstrParamNames); + free(bstrParamNames); SysFreeString(bstrName); SysFreeString(bstrHelpString); ITypeInfo_ReleaseFuncDesc(pTypeInfo, pFuncDesc); @@ -1449,8 +1447,8 @@ static void EmptyTLTree(void) SendMessageW(typelib.hTree, TVM_GETITEMW, 0, (LPARAM)&tvi); if(tvi.lParam) { - HeapFree(GetProcessHeap(), 0, ((TYPELIB_DATA *)tvi.lParam)->idl); - HeapFree(GetProcessHeap(), 0, (TYPELIB_DATA *)tvi.lParam); + free(((TYPELIB_DATA*)tvi.lParam)->idl); + free((TYPELIB_DATA*)tvi.lParam); } SendMessageW(typelib.hTree, TVM_DELETEITEM, 0, (LPARAM)del);