Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/atl/atl.c | 11 +++++------
dlls/atl/atl30.c | 2 +-
dlls/atl/atl_ax.c | 24 +++++++++++------------
dlls/atl/registrar.c | 45 ++++++++++++++++++++++----------------------
4 files changed, 40 insertions(+), 42 deletions(-)
diff --git a/dlls/atl/atl.c b/dlls/atl/atl.c
index ed6afe4ea2e..87a24e33ed7 100644
--- a/dlls/atl/atl.c
+++ b/dlls/atl/atl.c
@@ -23,7 +23,6 @@
#include "atlcom.h"
#include "wine/debug.h"
-#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(atl);
@@ -294,7 +293,7 @@ HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULE *pM, _ATL_TERMFUNC *pFunc, DWORD
TRACE("version %04x (%p %p %Id)\n", _ATL_VER, pM, pFunc, dw);
if (_ATL_VER > _ATL_VER_30 || pM->cbSize > ATLVer1Size) {
- termfunc_elem = HeapAlloc(GetProcessHeap(), 0, sizeof(_ATL_TERMFUNC_ELEM));
+ termfunc_elem = malloc(sizeof(*termfunc_elem));
termfunc_elem->pFunc = pFunc;
termfunc_elem->dw = dw;
termfunc_elem->pNext = pM->m_pTermFuncs;
@@ -320,7 +319,7 @@ void WINAPI AtlCallTermFunc(_ATL_MODULE *pM)
iter->pFunc(iter->dw);
tmp = iter;
iter = iter->pNext;
- HeapFree(GetProcessHeap(), 0, tmp);
+ free(tmp);
}
pM->m_pTermFuncs = NULL;
@@ -342,13 +341,13 @@ HRESULT WINAPI AtlLoadTypeLib(HINSTANCE inst, LPCOLESTR lpszIndex,
TRACE("(%p %s %p %p)\n", inst, debugstr_w(lpszIndex), pbstrPath, ppTypeLib);
index_len = lpszIndex ? lstrlenW(lpszIndex) : 0;
- path = heap_alloc((MAX_PATH+index_len)*sizeof(WCHAR) + sizeof(L".tlb"));
+ path = malloc((MAX_PATH+index_len)*sizeof(WCHAR) + sizeof(L".tlb"));
if(!path)
return E_OUTOFMEMORY;
path_len = GetModuleFileNameW(inst, path, MAX_PATH);
if(!path_len) {
- heap_free(path);
+ free(path);
return HRESULT_FROM_WIN32(GetLastError());
}
@@ -374,7 +373,7 @@ HRESULT WINAPI AtlLoadTypeLib(HINSTANCE inst, LPCOLESTR lpszIndex,
}
}
- heap_free(path);
+ free(path);
if(FAILED(hres))
return hres;
diff --git a/dlls/atl/atl30.c b/dlls/atl/atl30.c
index e84656998b8..d7d130c2a03 100644
--- a/dlls/atl/atl30.c
+++ b/dlls/atl/atl30.c
@@ -121,7 +121,7 @@ HRESULT WINAPI AtlModuleTerm(_ATL_MODULE *pM)
iter->pFunc(iter->dw);
tmp = iter;
iter = iter->pNext;
- HeapFree(GetProcessHeap(), 0, tmp);
+ free(tmp);
}
}
diff --git a/dlls/atl/atl_ax.c b/dlls/atl/atl_ax.c
index 04b0afdb759..4ff0a796d3b 100644
--- a/dlls/atl/atl_ax.c
+++ b/dlls/atl/atl_ax.c
@@ -63,12 +63,12 @@ static LRESULT CALLBACK AtlAxWin_wndproc( HWND hWnd, UINT wMsg, WPARAM wParam, L
if ( wMsg == WM_CREATE )
{
DWORD len = GetWindowTextLengthW( hWnd ) + 1;
- WCHAR *ptr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
+ WCHAR *ptr = malloc( len*sizeof(WCHAR) );
if (!ptr)
return 1;
GetWindowTextW( hWnd, ptr, len );
AtlAxCreateControlEx( ptr, hWnd, NULL, NULL, NULL, NULL, NULL );
- HeapFree( GetProcessHeap(), 0, ptr );
+ free( ptr );
return 0;
}
return DefWindowProcW( hWnd, wMsg, wParam, lParam );
@@ -225,7 +225,7 @@ static ULONG WINAPI OleClientSite_Release(IOleClientSite *iface)
if (!ref)
{
IOCS_Detach( This );
- HeapFree( GetProcessHeap(), 0, This );
+ free( This );
}
return ref;
@@ -945,7 +945,7 @@ static HRESULT IOCS_Create( HWND hWnd, IUnknown *pUnkControl, IUnknown **contain
return S_OK;
*container = NULL;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(IOCS));
+ This = malloc(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
@@ -969,7 +969,7 @@ static HRESULT IOCS_Create( HWND hWnd, IUnknown *pUnkControl, IUnknown **contain
else
{
IOCS_Detach( This );
- HeapFree(GetProcessHeap(), 0, This);
+ free(This);
}
return hr;
@@ -1160,7 +1160,7 @@ static inline BOOL advance_array(WORD **pptr, DWORD *palloc, DWORD *pfilled, con
if ( (*pfilled + size) > *palloc )
{
*palloc = ((*pfilled+size) + 0xFF) & ~0xFF;
- *pptr = HeapReAlloc( GetProcessHeap(), 0, *pptr, *palloc * sizeof(WORD) );
+ *pptr = realloc( *pptr, *palloc * sizeof(WORD) );
if (!*pptr)
return FALSE;
}
@@ -1186,7 +1186,7 @@ static LPDLGTEMPLATEW AX_ConvertDialogTemplate(LPCDLGTEMPLATEW src_tmpl)
DWORD style;
filled = 0; allocated = 256;
- output = HeapAlloc( GetProcessHeap(), 0, allocated * sizeof(WORD) );
+ output = malloc( allocated * sizeof(WORD) );
if (!output)
return NULL;
@@ -1307,12 +1307,12 @@ HWND WINAPI AtlAxCreateDialogA(HINSTANCE hInst, LPCSTR name, HWND owner, DLGPROC
return AtlAxCreateDialogW( hInst, (LPCWSTR) name, owner, dlgProc, param );
length = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
- nameW = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
+ nameW = malloc( length * sizeof(WCHAR) );
if (nameW)
{
MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, length );
res = AtlAxCreateDialogW( hInst, nameW, owner, dlgProc, param );
- HeapFree( GetProcessHeap(), 0, nameW );
+ free( nameW );
}
return res;
}
@@ -1348,8 +1348,8 @@ HWND WINAPI AtlAxCreateDialogW(HINSTANCE hInst, LPCWSTR name, HWND owner, DLGPRO
newptr = AX_ConvertDialogTemplate( ptr );
if ( newptr )
{
- res = CreateDialogIndirectParamW( hInst, newptr, owner, dlgProc, param );
- HeapFree( GetProcessHeap(), 0, newptr );
+ res = CreateDialogIndirectParamW( hInst, newptr, owner, dlgProc, param );
+ free( newptr );
} else
res = NULL;
FreeResource ( hrsrc );
@@ -1425,7 +1425,7 @@ INT_PTR WINAPI AtlAxDialogBoxW(HINSTANCE instance, const WCHAR *name,
return 0;
ret = DialogBoxIndirectParamW(instance, template, owner, proc, param);
- HeapFree(GetProcessHeap(), 0, template);
+ free(template);
return ret;
}
diff --git a/dlls/atl/registrar.c b/dlls/atl/registrar.c
index 061483f6513..5a3eef7dd4f 100644
--- a/dlls/atl/registrar.c
+++ b/dlls/atl/registrar.c
@@ -74,7 +74,7 @@ static inline Registrar *impl_from_IRegistrar(IRegistrar *iface)
static void strbuf_init(strbuf *buf)
{
- buf->str = HeapAlloc(GetProcessHeap(), 0, 128*sizeof(WCHAR));
+ buf->str = malloc(128*sizeof(WCHAR));
buf->alloc = 128;
buf->len = 0;
}
@@ -85,7 +85,7 @@ static void strbuf_write(LPCOLESTR str, strbuf *buf, int len)
len = lstrlenW(str);
if(buf->len+len+1 >= buf->alloc) {
buf->alloc = (buf->len+len)<<1;
- buf->str = HeapReAlloc(GetProcessHeap(), 0, buf->str, buf->alloc*sizeof(WCHAR));
+ buf->str = realloc(buf->str, buf->alloc*sizeof(WCHAR));
}
memcpy(buf->str+buf->len, str, len*sizeof(OLECHAR));
buf->len += len;
@@ -292,7 +292,7 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
if(FAILED(hres))
break;
count = (lstrlenW(buf->str) + 1) / 2;
- bytes = HeapAlloc(GetProcessHeap(), 0, count);
+ bytes = malloc(count);
if(bytes == NULL) {
hres = E_OUTOFMEMORY;
break;
@@ -313,7 +313,7 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
hres = HRESULT_FROM_WIN32(lres);
}
}
- HeapFree(GetProcessHeap(), 0, bytes);
+ free(bytes);
break;
}
default:
@@ -360,7 +360,7 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
break;
}
- HeapFree(GetProcessHeap(), 0, name.str);
+ free(name.str);
if(hkey && key_type != IS_VAL)
RegCloseKey(hkey);
*pstr = iter;
@@ -411,7 +411,7 @@ static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register)
if(FAILED(hres))
break;
}
- HeapFree(GetProcessHeap(), 0, buf.str);
+ free(buf.str);
return hres;
}
@@ -426,7 +426,7 @@ static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register
hres = do_preprocess(This, data, &buf);
if(FAILED(hres)) {
WARN("preprocessing failed!\n");
- HeapFree(GetProcessHeap(), 0, buf.str);
+ free(buf.str);
return hres;
}
@@ -434,7 +434,7 @@ static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register
if(FAILED(hres) && do_register)
do_process_root_key(buf.str, FALSE);
- HeapFree(GetProcessHeap(), 0, buf.str);
+ free(buf.str);
return hres;
}
@@ -456,13 +456,13 @@ static HRESULT resource_register(Registrar *This, LPCOLESTR resFileName,
reslen = SizeofResource(hins, src);
if(regstra) {
len = MultiByteToWideChar(CP_ACP, 0, regstra, reslen, NULL, 0)+1;
- regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
+ regstrw = calloc(len, sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, regstra, reslen, regstrw, len);
regstrw[len-1] = '\0';
hres = string_register(This, regstrw, do_register);
- HeapFree(GetProcessHeap(), 0, regstrw);
+ free(regstrw);
}else {
WARN("could not load resource\n");
hres = HRESULT_FROM_WIN32(GetLastError());
@@ -491,21 +491,21 @@ static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_regist
file = CreateFileW(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if(file != INVALID_HANDLE_VALUE) {
filelen = GetFileSize(file, NULL);
- regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
+ regstra = malloc(filelen);
if(ReadFile(file, regstra, filelen, NULL, NULL)) {
len = MultiByteToWideChar(CP_ACP, 0, regstra, filelen, NULL, 0)+1;
- regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
+ regstrw = calloc(len, sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, regstra, filelen, regstrw, len);
regstrw[len-1] = '\0';
hres = string_register(This, regstrw, do_register);
- HeapFree(GetProcessHeap(), 0, regstrw);
+ free(regstrw);
}else {
WARN("Failed to read file %s\n", debugstr_w(fileName));
hres = HRESULT_FROM_WIN32(GetLastError());
}
- HeapFree(GetProcessHeap(), 0, regstra);
+ free(regstra);
CloseHandle(file);
}else {
WARN("Could not open file %s\n", debugstr_w(fileName));
@@ -545,7 +545,7 @@ static ULONG WINAPI Registrar_Release(IRegistrar *iface)
TRACE("(%p) ->%ld\n", This, ref);
if(!ref) {
IRegistrar_ClearReplacements(iface);
- HeapFree(GetProcessHeap(), 0, This);
+ free(This);
}
return ref;
}
@@ -558,14 +558,14 @@ static HRESULT WINAPI Registrar_AddReplacement(IRegistrar *iface, LPCOLESTR Key,
TRACE("(%p)->(%s %s)\n", This, debugstr_w(Key), debugstr_w(item));
- new_rep = HeapAlloc(GetProcessHeap(), 0, sizeof(rep_list));
+ new_rep = malloc(sizeof(*new_rep));
new_rep->key_len = lstrlenW(Key);
- new_rep->key = HeapAlloc(GetProcessHeap(), 0, (new_rep->key_len + 1) * sizeof(OLECHAR));
+ new_rep->key = malloc((new_rep->key_len + 1) * sizeof(OLECHAR));
memcpy(new_rep->key, Key, (new_rep->key_len+1)*sizeof(OLECHAR));
len = lstrlenW(item)+1;
- new_rep->item = HeapAlloc(GetProcessHeap(), 0, len*sizeof(OLECHAR));
+ new_rep->item = malloc(len*sizeof(OLECHAR));
memcpy(new_rep->item, item, len*sizeof(OLECHAR));
new_rep->next = This->rep;
@@ -587,9 +587,9 @@ static HRESULT WINAPI Registrar_ClearReplacements(IRegistrar *iface)
iter = This->rep;
while(iter) {
iter2 = iter->next;
- HeapFree(GetProcessHeap(), 0, iter->key);
- HeapFree(GetProcessHeap(), 0, iter->item);
- HeapFree(GetProcessHeap(), 0, iter);
+ free(iter->key);
+ free(iter->item);
+ free(iter);
iter = iter2;
}
@@ -680,13 +680,12 @@ HRESULT WINAPI AtlCreateRegistrar(IRegistrar **ret)
{
Registrar *registrar;
- registrar = HeapAlloc(GetProcessHeap(), 0, sizeof(*registrar));
+ registrar = calloc(1, sizeof(*registrar));
if(!registrar)
return E_OUTOFMEMORY;
registrar->IRegistrar_iface.lpVtbl = &RegistrarVtbl;
registrar->ref = 1;
- registrar->rep = NULL;
*ret = ®istrar->IRegistrar_iface;
return S_OK;
--
2.35.1