From 5c00a8a330b926fbc09c4dcc697d15e2863f2731 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Wed, 23 Nov 2022 20:02:13 -0700 Subject: [PATCH] mshtml: Use standard C functions for memory allocation. --- dlls/mshtml/conpoint.c | 14 ++-- dlls/mshtml/dispex.c | 62 ++++++++------- dlls/mshtml/editor.c | 16 ++-- dlls/mshtml/htmlanchor.c | 2 +- dlls/mshtml/htmlarea.c | 2 +- dlls/mshtml/htmlattr.c | 8 +- dlls/mshtml/htmlbody.c | 2 +- dlls/mshtml/htmlcomment.c | 2 +- dlls/mshtml/htmlcurstyle.c | 2 +- dlls/mshtml/htmldoc.c | 28 +++---- dlls/mshtml/htmlelem.c | 44 +++++------ dlls/mshtml/htmlelemcol.c | 34 ++++---- dlls/mshtml/htmlevent.c | 46 +++++------ dlls/mshtml/htmlform.c | 6 +- dlls/mshtml/htmlframe.c | 4 +- dlls/mshtml/htmlgeneric.c | 2 +- dlls/mshtml/htmlhead.c | 8 +- dlls/mshtml/htmlimg.c | 6 +- dlls/mshtml/htmlinput.c | 6 +- dlls/mshtml/htmllink.c | 2 +- dlls/mshtml/htmllocation.c | 18 ++--- dlls/mshtml/htmlnode.c | 12 +-- dlls/mshtml/htmlobject.c | 4 +- dlls/mshtml/htmlscript.c | 4 +- dlls/mshtml/htmlselect.c | 12 +-- dlls/mshtml/htmlstorage.c | 52 ++++++------- dlls/mshtml/htmlstyle.c | 28 +++---- dlls/mshtml/htmlstyleelem.c | 2 +- dlls/mshtml/htmlstylesheet.c | 24 +++--- dlls/mshtml/htmltable.c | 6 +- dlls/mshtml/htmltextarea.c | 2 +- dlls/mshtml/htmltextnode.c | 2 +- dlls/mshtml/htmlwindow.c | 24 +++--- dlls/mshtml/ifacewrap.c | 4 +- dlls/mshtml/loadopts.c | 14 ++-- dlls/mshtml/main.c | 40 +++++----- dlls/mshtml/mshtml_private.h | 62 +++------------ dlls/mshtml/mutation.c | 14 ++-- dlls/mshtml/navigate.c | 76 +++++++++--------- dlls/mshtml/nsembed.c | 44 +++++------ dlls/mshtml/nsevents.c | 4 +- dlls/mshtml/nsio.c | 146 +++++++++++++++++------------------ dlls/mshtml/olecmd.c | 4 +- dlls/mshtml/oleobj.c | 10 +-- dlls/mshtml/omnavigator.c | 50 ++++++------ dlls/mshtml/persist.c | 20 ++--- dlls/mshtml/pluginhost.c | 48 ++++++------ dlls/mshtml/protocol.c | 28 +++---- dlls/mshtml/range.c | 20 ++--- dlls/mshtml/script.c | 40 +++++----- dlls/mshtml/selection.c | 4 +- dlls/mshtml/service.c | 8 +- dlls/mshtml/svg.c | 8 +- dlls/mshtml/task.c | 10 +-- dlls/mshtml/view.c | 2 +- dlls/mshtml/xmlhttprequest.c | 34 ++++---- 56 files changed, 570 insertions(+), 606 deletions(-) diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c index baedc8472c1..52a99dd411f 100644 --- a/dlls/mshtml/conpoint.c +++ b/dlls/mshtml/conpoint.c @@ -84,7 +84,7 @@ static ULONG WINAPI EnumConnections_Release(IEnumConnections *iface) if(!ref) { IConnectionPoint_Release(&This->cp->IConnectionPoint_iface); - heap_free(This); + free(This); } return ref; @@ -234,9 +234,9 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown * } if(i == This->sinks_size) - This->sinks = heap_realloc(This->sinks,(++This->sinks_size)*sizeof(*This->sinks)); + This->sinks = realloc(This->sinks, (++This->sinks_size) * sizeof(*This->sinks)); }else { - This->sinks = heap_alloc(sizeof(*This->sinks)); + This->sinks = malloc(sizeof(*This->sinks)); This->sinks_size = 1; i = 0; } @@ -273,7 +273,7 @@ static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface, TRACE("(%p)->(%p)\n", This, ppEnum); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -319,7 +319,7 @@ static void ConnectionPoint_Destroy(ConnectionPoint *This) IUnknown_Release(This->sinks[i].unk); } - heap_free(This->sinks); + free(This->sinks); } static ConnectionPoint *get_cp(ConnectionPointContainer *container, REFIID riid, BOOL do_create) @@ -341,7 +341,7 @@ static ConnectionPoint *get_cp(ConnectionPointContainer *container, REFIID riid, while(iter->riid) iter++; - container->cps = heap_alloc((iter - container->cp_entries) * sizeof(*container->cps)); + container->cps = malloc((iter - container->cp_entries) * sizeof(*container->cps)); if(!container->cps) return NULL; @@ -449,5 +449,5 @@ void ConnectionPointContainer_Destroy(ConnectionPointContainer *This) for(i=0; This->cp_entries[i].riid; i++) ConnectionPoint_Destroy(This->cps+i); - heap_free(This->cps); + free(This->cps); } diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 61acef7e28b..1d00012572b 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -202,14 +202,14 @@ void release_typelib(void) for(j = 0; j < iter->funcs[i].argc; j++) VariantClear(&iter->funcs[i].arg_info[j].default_value); } - heap_free(iter->funcs[i].arg_types); - heap_free(iter->funcs[i].arg_info); + free(iter->funcs[i].arg_types); + free(iter->funcs[i].arg_info); SysFreeString(iter->funcs[i].name); } - heap_free(iter->funcs); - heap_free(iter->name_table); - heap_free(iter); + free(iter->funcs); + free(iter->name_table); + free(iter); } if(!typelib) @@ -301,10 +301,12 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc, if(info == data->funcs+data->func_cnt) { if(data->func_cnt == data->func_size) { - info = heap_realloc_zero(data->funcs, (data->func_size <<= 1) * sizeof(func_info_t)); + info = realloc(data->funcs, data->func_size * 2 * sizeof(func_info_t)); if(!info) return; + memset(info + data->func_size, 0, data->func_size * sizeof(func_info_t)); data->funcs = info; + data->func_size *= 2; } info = data->funcs+data->func_cnt; @@ -329,7 +331,7 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc, assert(info->argc < MAX_ARGS); assert(desc->funckind == FUNC_DISPATCH); - info->arg_info = heap_alloc_zero(sizeof(*info->arg_info) * info->argc); + info->arg_info = calloc(info->argc, sizeof(*info->arg_info)); if(!info->arg_info) return; @@ -339,7 +341,7 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc, return; /* Fallback to ITypeInfo::Invoke */ } - info->arg_types = heap_alloc(sizeof(*info->arg_types) * (info->argc + (info->prop_vt == VT_VOID ? 0 : 1))); + info->arg_types = malloc(sizeof(*info->arg_types) * (info->argc + (info->prop_vt == VT_VOID ? 0 : 1))); if(!info->arg_types) return; @@ -496,7 +498,7 @@ static dispex_data_t *preprocess_dispex_data(dispex_static_data_t *desc, compat_ } } - data = heap_alloc(sizeof(dispex_data_t)); + data = malloc(sizeof(dispex_data_t)); if (!data) { ERR("Out of memory\n"); return NULL; @@ -506,9 +508,9 @@ static dispex_data_t *preprocess_dispex_data(dispex_static_data_t *desc, compat_ data->func_cnt = 0; data->func_disp_cnt = 0; data->func_size = 16; - data->funcs = heap_alloc_zero(data->func_size*sizeof(func_info_t)); + data->funcs = calloc(data->func_size, sizeof(func_info_t)); if (!data->funcs) { - heap_free (data); + free(data); ERR("Out of memory\n"); return NULL; } @@ -524,7 +526,7 @@ static dispex_data_t *preprocess_dispex_data(dispex_static_data_t *desc, compat_ } if(!data->func_cnt) { - heap_free(data->funcs); + free(data->funcs); data->name_table = NULL; data->funcs = NULL; data->func_size = 0; @@ -532,10 +534,10 @@ static dispex_data_t *preprocess_dispex_data(dispex_static_data_t *desc, compat_ } - data->funcs = heap_realloc(data->funcs, data->func_cnt * sizeof(func_info_t)); + data->funcs = realloc(data->funcs, data->func_cnt * sizeof(func_info_t)); qsort(data->funcs, data->func_cnt, sizeof(func_info_t), dispid_cmp); - data->name_table = heap_alloc(data->func_cnt * sizeof(func_info_t*)); + data->name_table = malloc(data->func_cnt * sizeof(func_info_t*)); for(i=0; i < data->func_cnt; i++) data->name_table[i] = data->funcs+i; qsort(data->name_table, data->func_cnt, sizeof(func_info_t*), func_name_cmp); @@ -569,7 +571,7 @@ HRESULT get_dispids(tid_t tid, DWORD *ret_size, DISPID **ret) func_cnt = attr->cFuncs; ITypeInfo_ReleaseTypeAttr(ti, attr); - ids = heap_alloc(func_cnt*sizeof(DISPID)); + ids = malloc(func_cnt * sizeof(DISPID)); if(!ids) { ITypeInfo_Release(ti); return E_OUTOFMEMORY; @@ -586,7 +588,7 @@ HRESULT get_dispids(tid_t tid, DWORD *ret_size, DISPID **ret) ITypeInfo_Release(ti); if(FAILED(hres)) { - heap_free(ids); + free(ids); return hres; } @@ -632,7 +634,7 @@ static inline dispex_dynamic_data_t *get_dynamic_data(DispatchEx *This) if(This->dynamic_data) return This->dynamic_data; - This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t)); + This->dynamic_data = calloc(1, sizeof(dispex_dynamic_data_t)); if(!This->dynamic_data) return NULL; @@ -670,14 +672,14 @@ static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags TRACE("creating dynamic prop %s\n", debugstr_w(name)); if(!data->buf_size) { - data->props = heap_alloc(sizeof(dynamic_prop_t)*4); + data->props = malloc(sizeof(dynamic_prop_t) * 4); if(!data->props) return E_OUTOFMEMORY; data->buf_size = 4; }else if(data->buf_size == data->prop_cnt) { dynamic_prop_t *new_props; - new_props = heap_realloc(data->props, sizeof(dynamic_prop_t)*(data->buf_size<<1)); + new_props = realloc(data->props, sizeof(dynamic_prop_t) * (data->buf_size << 1)); if(!new_props) return E_OUTOFMEMORY; @@ -687,7 +689,7 @@ static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags prop = data->props + data->prop_cnt; - prop->name = heap_strdupW(name); + prop->name = wcsdup(name); if(!prop->name) return E_OUTOFMEMORY; @@ -827,7 +829,7 @@ static ULONG WINAPI Function_Release(IUnknown *iface) if(!ref) { assert(!This->obj); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -919,7 +921,7 @@ static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info) { func_disp_t *ret; - ret = heap_alloc_zero(sizeof(func_disp_t)); + ret = calloc(1, sizeof(func_disp_t)); if(!ret) return NULL; @@ -945,7 +947,7 @@ static HRESULT invoke_disp_value(DispatchEx *This, IDispatch *func_disp, LCID lc return E_NOTIMPL; } - new_dp.rgvarg = heap_alloc((dp->cArgs+1)*sizeof(VARIANTARG)); + new_dp.rgvarg = malloc((dp->cArgs + 1) * sizeof(VARIANTARG)); if(!new_dp.rgvarg) return E_OUTOFMEMORY; @@ -969,7 +971,7 @@ static HRESULT invoke_disp_value(DispatchEx *This, IDispatch *func_disp, LCID lc else WARN("<<< %08lx\n", hres); - heap_free(new_dp.rgvarg); + free(new_dp.rgvarg); return hres; } @@ -983,7 +985,7 @@ static HRESULT get_func_obj_entry(DispatchEx *This, func_info_t *func, func_obj_ return E_OUTOFMEMORY; if(!dynamic_data->func_disps) { - dynamic_data->func_disps = heap_alloc_zero(This->info->func_disp_cnt * sizeof(*dynamic_data->func_disps)); + dynamic_data->func_disps = calloc(This->info->func_disp_cnt, sizeof(*dynamic_data->func_disps)); if(!dynamic_data->func_disps) return E_OUTOFMEMORY; } @@ -2035,10 +2037,10 @@ void release_dispex(DispatchEx *This) for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) { VariantClear(&prop->var); - heap_free(prop->name); + free(prop->name); } - heap_free(This->dynamic_data->props); + free(This->dynamic_data->props); if(This->dynamic_data->func_disps) { func_obj_entry_t *iter; @@ -2051,10 +2053,10 @@ void release_dispex(DispatchEx *This) VariantClear(&iter->val); } - heap_free(This->dynamic_data->func_disps); + free(This->dynamic_data->func_disps); } - heap_free(This->dynamic_data); + free(This->dynamic_data); } void init_dispatch(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data, compat_mode_t compat_mode) @@ -2070,7 +2072,7 @@ void init_dispatch(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *da if(!data->delayed_init_info) { EnterCriticalSection(&cs_dispex_static_data); if(!data->delayed_init_info) { - dispex_data_t *info = heap_alloc_zero(sizeof(*data->delayed_init_info)); + dispex_data_t *info = calloc(1, sizeof(*data->delayed_init_info)); if(info) { info->desc = data; data->delayed_init_info = info; diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c index cadfadb826e..478c30932c1 100644 --- a/dlls/mshtml/editor.c +++ b/dlls/mshtml/editor.c @@ -523,9 +523,9 @@ static HRESULT exec_fontname(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *i TRACE("%s\n", debugstr_w(V_BSTR(in))); - stra = heap_strdupWtoA(V_BSTR(in)); + stra = strdupWtoA(V_BSTR(in)); set_ns_fontname(doc, stra); - heap_free(stra); + free(stra); update_doc(doc->browser->doc, UPDATE_UI); } @@ -550,12 +550,12 @@ static HRESULT exec_fontname(HTMLDocumentNode *doc, DWORD cmdexecopt, VARIANT *i nsICommandParams_Release(nsparam); len = MultiByteToWideChar(CP_ACP, 0, stra, -1, NULL, 0); - strw = heap_alloc(len*sizeof(WCHAR)); + strw = malloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, stra, -1, strw, len); nsfree(stra); V_BSTR(out) = SysAllocString(strw); - heap_free(strw); + free(strw); } return S_OK; @@ -1015,7 +1015,7 @@ static INT_PTR CALLBACK hyperlink_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LP /* get string of currently selected hyperlink type */ item = SendMessageW((HWND)lparam, CB_GETCURSEL, 0, 0); len = SendMessageW((HWND)lparam, CB_GETLBTEXTLEN, item, 0); - type = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); + type = malloc((len + 1) * sizeof(WCHAR)); SendMessageW((HWND)lparam, CB_GETLBTEXT, item, (LPARAM)type); if (!wcscmp(type, L"(other)")) @@ -1023,7 +1023,7 @@ static INT_PTR CALLBACK hyperlink_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LP /* get current URL */ len = GetWindowTextLengthW(hwndURL); - url = HeapAlloc(GetProcessHeap(), 0, (len + lstrlenW(type) + 3) * sizeof(WCHAR)); + url = malloc((len + lstrlenW(type) + 3) * sizeof(WCHAR)); GetWindowTextW(hwndURL, url, len + 1); /* strip off old protocol */ @@ -1043,8 +1043,8 @@ static INT_PTR CALLBACK hyperlink_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LP SetWindowTextW(hwndURL, url); - HeapFree(GetProcessHeap(), 0, url); - HeapFree(GetProcessHeap(), 0, type); + free(url); + free(type); return TRUE; } } diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 633bb88e9df..1e783ce007e 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -913,7 +913,7 @@ HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H HTMLAnchorElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLAnchorElement)); + ret = calloc(1, sizeof(HTMLAnchorElement)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlarea.c b/dlls/mshtml/htmlarea.c index 9e43a7b0e80..eb7ea383db9 100644 --- a/dlls/mshtml/htmlarea.c +++ b/dlls/mshtml/htmlarea.c @@ -489,7 +489,7 @@ HRESULT HTMLAreaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTM HTMLAreaElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLAreaElement)); + ret = calloc(1, sizeof(HTMLAreaElement)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlattr.c b/dlls/mshtml/htmlattr.c index 82ded4d8a8e..b7e40a23d55 100644 --- a/dlls/mshtml/htmlattr.c +++ b/dlls/mshtml/htmlattr.c @@ -83,8 +83,8 @@ static ULONG WINAPI HTMLDOMAttribute_Release(IHTMLDOMAttribute *iface) assert(!This->elem); release_dispex(&This->dispex); VariantClear(&This->value); - heap_free(This->name); - heap_free(This); + free(This->name); + free(This); } return ref; @@ -503,7 +503,7 @@ HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dis HTMLDOMAttribute *ret; HRESULT hres; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -530,7 +530,7 @@ HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dis /* For detached attributes we may still do most operations if we have its name available. */ if(name) { - ret->name = heap_strdupW(name); + ret->name = wcsdup(name); if(!ret->name) { IHTMLDOMAttribute_Release(&ret->IHTMLDOMAttribute_iface); return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c index 25cb9421cc3..6338e7e907b 100644 --- a/dlls/mshtml/htmlbody.c +++ b/dlls/mshtml/htmlbody.c @@ -1021,7 +1021,7 @@ HRESULT HTMLBodyElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTM HTMLBodyElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLBodyElement)); + ret = calloc(1, sizeof(HTMLBodyElement)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c index a9843858a9b..cc3bec32959 100644 --- a/dlls/mshtml/htmlcomment.c +++ b/dlls/mshtml/htmlcomment.c @@ -210,7 +210,7 @@ HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTM { HTMLCommentElement *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c index f38381e530f..c7a9a3c086d 100644 --- a/dlls/mshtml/htmlcurstyle.c +++ b/dlls/mshtml/htmlcurstyle.c @@ -1345,7 +1345,7 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p) return E_FAIL; } - ret = heap_alloc_zero(sizeof(HTMLCurrentStyle)); + ret = calloc(1, sizeof(HTMLCurrentStyle)); if(!ret) { nsIDOMCSSStyleDeclaration_Release(nsstyle); return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 85f2e0eaace..d4d32693f80 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -398,7 +398,7 @@ HRESULT create_doctype_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNo DocumentType *doctype; nsresult nsres; - if(!(doctype = heap_alloc_zero(sizeof(*doctype)))) + if(!(doctype = calloc(1, sizeof(*doctype)))) return E_OUTOFMEMORY; nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMDocumentType, (void**)&nsdoctype); @@ -2721,7 +2721,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST return E_NOTIMPL; } - selector = heap_alloc(2*SysStringLen(v)*sizeof(WCHAR) + sizeof(formatW)); + selector = malloc(2 * SysStringLen(v) * sizeof(WCHAR) + sizeof(formatW)); if(!selector) return E_OUTOFMEMORY; swprintf(selector, 2*SysStringLen(v) + ARRAY_SIZE(formatW), formatW, v, v); @@ -2734,7 +2734,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BST nsAString_InitDepend(&selector_str, selector); nsres = nsIDOMDocument_QuerySelectorAll(This->dom_document, &selector_str, &node_list); nsAString_Finish(&selector_str); - heap_free(selector); + free(selector); if(NS_FAILED(nsres)) { ERR("QuerySelectorAll failed: %08lx\n", nsres); return E_FAIL; @@ -4925,7 +4925,7 @@ static HRESULT has_elem_name(nsIDOMHTMLDocument *html_document, const WCHAR *nam size_t len; len = wcslen(name) + ARRAY_SIZE(fmt) - 2 /* %s */; - if(len > ARRAY_SIZE(buf) && !(selector = heap_alloc(len * sizeof(WCHAR)))) + if(len > ARRAY_SIZE(buf) && !(selector = malloc(len * sizeof(WCHAR)))) return E_OUTOFMEMORY; swprintf(selector, len, fmt, name); @@ -4933,7 +4933,7 @@ static HRESULT has_elem_name(nsIDOMHTMLDocument *html_document, const WCHAR *nam nsres = nsIDOMHTMLDocument_QuerySelector(html_document, &selector_str, &nselem); nsAString_Finish(&selector_str); if(selector != buf) - heap_free(selector); + free(selector); if(NS_FAILED(nsres)) return map_nsresult(nsres); @@ -4954,7 +4954,7 @@ static HRESULT get_elem_by_name_or_id(nsIDOMHTMLDocument *html_document, const W size_t len; len = wcslen(name) * 4 + ARRAY_SIZE(fmt) - 8 /* %s */; - if(len > ARRAY_SIZE(buf) && !(selector = heap_alloc(len * sizeof(WCHAR)))) + if(len > ARRAY_SIZE(buf) && !(selector = malloc(len * sizeof(WCHAR)))) return E_OUTOFMEMORY; swprintf(selector, len, fmt, name, name, name, name); @@ -4962,7 +4962,7 @@ static HRESULT get_elem_by_name_or_id(nsIDOMHTMLDocument *html_document, const W nsres = nsIDOMHTMLDocument_QuerySelector(html_document, &selector_str, &nselem); nsAString_Finish(&selector_str); if(selector != buf) - heap_free(selector); + free(selector); if(NS_FAILED(nsres)) return map_nsresult(nsres); @@ -4993,12 +4993,12 @@ static HRESULT dispid_from_elem_name(HTMLDocumentNode *This, const WCHAR *name, WCHAR **new_vars; if(This->elem_vars_size) { - new_vars = heap_realloc(This->elem_vars, This->elem_vars_size*2*sizeof(WCHAR*)); + new_vars = realloc(This->elem_vars, This->elem_vars_size * 2 * sizeof(WCHAR*)); if(!new_vars) return E_OUTOFMEMORY; This->elem_vars_size *= 2; }else { - new_vars = heap_alloc(16*sizeof(WCHAR*)); + new_vars = malloc(16 * sizeof(WCHAR*)); if(!new_vars) return E_OUTOFMEMORY; This->elem_vars_size = 16; @@ -5007,7 +5007,7 @@ static HRESULT dispid_from_elem_name(HTMLDocumentNode *This, const WCHAR *name, This->elem_vars = new_vars; } - This->elem_vars[This->elem_vars_cnt] = heap_strdupW(name); + This->elem_vars[This->elem_vars_cnt] = wcsdup(name); if(!This->elem_vars[This->elem_vars_cnt]) return E_OUTOFMEMORY; @@ -5834,8 +5834,8 @@ void detach_document_node(HTMLDocumentNode *doc) detach_ranges(doc); for(i=0; i < doc->elem_vars_cnt; i++) - heap_free(doc->elem_vars[i]); - heap_free(doc->elem_vars); + free(doc->elem_vars[i]); + free(doc->elem_vars); doc->elem_vars_cnt = doc->elem_vars_size = 0; doc->elem_vars = NULL; @@ -5862,7 +5862,7 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) TRACE("(%p)\n", This); - heap_free(This->event_vector); + free(This->event_vector); ConnectionPointContainer_Destroy(&This->cp_container); } @@ -6198,7 +6198,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo { HTMLDocumentNode *doc; - doc = heap_alloc_zero(sizeof(HTMLDocumentNode)); + doc = calloc(1, sizeof(HTMLDocumentNode)); if(!doc) return NULL; diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 541806fa8b2..24040d914ec 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -434,7 +434,7 @@ static HRESULT create_nselem_parse(HTMLDocumentNode *doc, const WCHAR *tag, nsID if(NS_FAILED(nsres)) return map_nsresult(nsres); - if(!(p = heap_alloc(sizeof(prefix) + size))) { + if(!(p = malloc(sizeof(prefix) + size))) { nsIDOMRange_Release(nsrange); return E_OUTOFMEMORY; } @@ -445,7 +445,7 @@ static HRESULT create_nselem_parse(HTMLDocumentNode *doc, const WCHAR *tag, nsID nsIDOMRange_CreateContextualFragment(nsrange, &str, &nsfragment); nsIDOMRange_Release(nsrange); nsAString_Finish(&str); - heap_free(p); + free(p); if(NS_FAILED(nsres)) return map_nsresult(nsres); @@ -460,7 +460,7 @@ static HRESULT create_nselem_parse(HTMLDocumentNode *doc, const WCHAR *tag, nsID if(NS_FAILED(nsres)) return E_FAIL; - if(!(p = heap_alloc((name_len + 1) * sizeof(WCHAR)))) + if(!(p = malloc((name_len + 1) * sizeof(WCHAR)))) hres = E_OUTOFMEMORY; else { memcpy(p, tag + 1, name_len * sizeof(WCHAR)); @@ -469,7 +469,7 @@ static HRESULT create_nselem_parse(HTMLDocumentNode *doc, const WCHAR *tag, nsID nsAString_InitDepend(&str, p); nsres = nsIDOMDocument_CreateElement(doc->dom_document, &str, ret); nsAString_Finish(&str); - heap_free(p); + free(p); if(NS_FAILED(nsres)) hres = map_nsresult(nsres); @@ -583,7 +583,7 @@ static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface) if(This->nsrect) nsIDOMClientRect_Release(This->nsrect); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -756,7 +756,7 @@ static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_m { HTMLRect *rect; - rect = heap_alloc_zero(sizeof(HTMLRect)); + rect = calloc(1, sizeof(HTMLRect)); if(!rect) return E_OUTOFMEMORY; @@ -834,7 +834,7 @@ static ULONG WINAPI HTMLRectCollectionEnum_Release(IEnumVARIANT *iface) if(!ref) { IHTMLRectCollection_Release(&This->col->IHTMLRectCollection_iface); - heap_free(This); + free(This); } return ref; @@ -962,7 +962,7 @@ static ULONG WINAPI HTMLRectCollection_Release(IHTMLRectCollection *iface) if(This->rect_list) nsIDOMClientRectList_Release(This->rect_list); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -1020,7 +1020,7 @@ static HRESULT WINAPI HTMLRectCollection_get__newEnum(IHTMLRectCollection *iface TRACE("(%p)->(%p)\n", This, p); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -3183,7 +3183,7 @@ static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRec return map_nsresult(nsres); } - rects = heap_alloc_zero(sizeof(*rects)); + rects = calloc(1, sizeof(*rects)); if(!rects) { nsIDOMClientRectList_Release(rect_list); return E_OUTOFMEMORY; @@ -6737,7 +6737,7 @@ void HTMLElement_destructor(HTMLDOMNode *iface) IHTMLAttributeCollection_Release(&This->attrs->IHTMLAttributeCollection_iface); } - heap_free(This->filter); + free(This->filter); HTMLDOMNode_destructor(&This->node); } @@ -6753,7 +6753,7 @@ HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode ** return hres; if(This->filter) { - new_elem->filter = heap_strdupW(This->filter); + new_elem->filter = wcsdup(This->filter); if(!new_elem->filter) { IHTMLElement_Release(&This->IHTMLElement_iface); return E_OUTOFMEMORY; @@ -7290,7 +7290,7 @@ static ULONG WINAPI token_list_Release(IWineDOMTokenList *iface) if(!ref) { IHTMLElement_Release(token_list->element); release_dispex(&token_list->dispex); - heap_free(token_list); + free(token_list); } return ref; @@ -7519,7 +7519,7 @@ static HRESULT create_token_list(compat_mode_t compat_mode, IHTMLElement *elemen { struct token_list *obj; - obj = heap_alloc_zero(sizeof(*obj)); + obj = calloc(1, sizeof(*obj)); if(!obj) { ERR("No memory.\n"); @@ -7708,7 +7708,7 @@ HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_g }else if(use_generic) { hres = HTMLGenericElement_Create(doc, nselem, &elem); }else { - elem = heap_alloc_zero(sizeof(HTMLElement)); + elem = calloc(1, sizeof(HTMLElement)); if(elem) { elem->node.vtbl = &HTMLElementImplVtbl; HTMLElement_Init(elem, doc, nselem, &HTMLUnknownElement_dispex); @@ -7734,7 +7734,7 @@ static HRESULT HTMLElement_Ctor(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT { HTMLElement *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -7801,7 +7801,7 @@ static ULONG WINAPI HTMLFiltersCollection_Release(IHTMLFiltersCollection *iface) if(!ref) { - heap_free(This); + free(This); } return ref; @@ -7939,7 +7939,7 @@ static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFilters { HTMLFiltersCollection *collection; - if(!(collection = heap_alloc(sizeof(HTMLFiltersCollection)))) + if(!(collection = malloc(sizeof(HTMLFiltersCollection)))) return E_OUTOFMEMORY; collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl; @@ -8099,7 +8099,7 @@ static ULONG WINAPI HTMLAttributeCollectionEnum_Release(IEnumVARIANT *iface) if(!ref) { IHTMLAttributeCollection_Release(&This->col->IHTMLAttributeCollection_iface); - heap_free(This); + free(This); } return ref; @@ -8257,7 +8257,7 @@ static ULONG WINAPI HTMLAttributeCollection_Release(IHTMLAttributeCollection *if IHTMLDOMAttribute_Release(&attr->IHTMLDOMAttribute_iface); } - heap_free(This); + free(This); } return ref; @@ -8312,7 +8312,7 @@ static HRESULT WINAPI HTMLAttributeCollection__newEnum(IHTMLAttributeCollection TRACE("(%p)->(%p)\n", This, p); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -8704,7 +8704,7 @@ HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **a return S_OK; } - This->attrs = heap_alloc_zero(sizeof(HTMLAttributeCollection)); + This->attrs = calloc(1, sizeof(HTMLAttributeCollection)); if(!This->attrs) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index cd3341b3946..6172bc2d57e 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -68,7 +68,7 @@ static void elem_vector_add(elem_vector_t *buf, HTMLElement *elem) { if(buf->len == buf->size) { buf->size <<= 1; - buf->buf = heap_realloc(buf->buf, buf->size*sizeof(HTMLElement*)); + buf->buf = realloc(buf->buf, buf->size * sizeof(HTMLElement*)); } buf->buf[buf->len++] = elem; @@ -77,10 +77,10 @@ static void elem_vector_add(elem_vector_t *buf, HTMLElement *elem) static void elem_vector_normalize(elem_vector_t *buf) { if(!buf->len) { - heap_free(buf->buf); + free(buf->buf); buf->buf = NULL; }else if(buf->size > buf->len) { - buf->buf = heap_realloc(buf->buf, buf->len*sizeof(HTMLElement*)); + buf->buf = realloc(buf->buf, buf->len*sizeof(HTMLElement*)); } buf->size = buf->len; @@ -139,7 +139,7 @@ static ULONG WINAPI HTMLElementCollectionEnum_Release(IEnumVARIANT *iface) if(!ref) { IHTMLElementCollection_Release(&This->col->IHTMLElementCollection_iface); - heap_free(This); + free(This); } return ref; @@ -257,10 +257,10 @@ static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface) for(i=0; i < This->len; i++) node_release(&This->elems[i]->node); - heap_free(This->elems); + free(This->elems); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -334,7 +334,7 @@ static HRESULT WINAPI HTMLElementCollection_get__newEnum(IHTMLElementCollection TRACE("(%p)->(%p)\n", This, p); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -450,7 +450,7 @@ static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface, }else { elem_vector_t buf = {NULL, 0, 8}; - buf.buf = heap_alloc(buf.size*sizeof(HTMLElement*)); + buf.buf = malloc(buf.size * sizeof(HTMLElement*)); for(i=0; ilen; i++) { if(is_elem_name(This->elems[i], V_BSTR(&name))) { @@ -469,7 +469,7 @@ static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface, *pdisp = (IDispatch*)&buf.buf[0]->IHTMLElement_iface; } - heap_free(buf.buf); + free(buf.buf); } } break; @@ -501,7 +501,7 @@ static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface, TRACE("(%p)->(%s %p)\n", This, debugstr_w(V_BSTR(&tagName)), pdisp); - buf.buf = heap_alloc(buf.size*sizeof(HTMLElement*)); + buf.buf = malloc(buf.size * sizeof(HTMLElement*)); nsAString_Init(&tag_str, NULL); @@ -685,7 +685,7 @@ IHTMLElementCollection *create_all_collection(HTMLDOMNode *node, BOOL include_ro { elem_vector_t buf = {NULL, 0, 8}; - buf.buf = heap_alloc(buf.size*sizeof(HTMLElement*)); + buf.buf = malloc(buf.size * sizeof(HTMLElement*)); if(include_root) { node_addref(node); @@ -712,7 +712,7 @@ IHTMLElementCollection *create_collection_from_nodelist(nsIDOMNodeList *nslist, if(length) { nsIDOMNode *nsnode; - buf.buf = heap_alloc(buf.size*sizeof(HTMLElement*)); + buf.buf = malloc(buf.size * sizeof(HTMLElement*)); for(i=0; iIHTMLDOMNode_iface); return E_OUTOFMEMORY; @@ -827,7 +827,7 @@ HRESULT get_elem_source_index(HTMLElement *elem, LONG *ret) break; } IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface); - heap_free(buf.buf); + free(buf.buf); if(i == buf.len) { FIXME("The element is not in parent's child list?\n"); return E_UNEXPECTED; @@ -840,7 +840,7 @@ HRESULT get_elem_source_index(HTMLElement *elem, LONG *ret) static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems, DWORD len, compat_mode_t compat_mode) { - HTMLElementCollection *ret = heap_alloc_zero(sizeof(HTMLElementCollection)); + HTMLElementCollection *ret = calloc(1, sizeof(HTMLElementCollection)); if (!ret) return NULL; diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index fec280d9a70..3b6d7a43999 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -280,7 +280,7 @@ static listener_container_t *get_listener_container(EventTarget *event_target, c FIXME("unimplemented event %s\n", debugstr_w(event_info[eid].name)); type_len = lstrlenW(type); - container = heap_alloc(FIELD_OFFSET(listener_container_t, type[type_len+1])); + container = malloc(FIELD_OFFSET(listener_container_t, type[type_len+1])); if(!container) return NULL; memcpy(container->type, type, (type_len + 1) * sizeof(WCHAR)); @@ -308,7 +308,7 @@ static void remove_event_listener(EventTarget *event_target, const WCHAR *type_n if(listener->function == function && listener->type == type) { IDispatch_Release(listener->function); list_remove(&listener->entry); - heap_free(listener); + free(listener); break; } } @@ -385,7 +385,7 @@ static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface) if(This->event) IDOMEvent_Release(&This->event->IDOMEvent_iface); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -884,7 +884,7 @@ static HTMLEventObj *alloc_event_obj(DOMEvent *event, compat_mode_t compat_mode) { HTMLEventObj *event_obj; - event_obj = heap_alloc_zero(sizeof(*event_obj)); + event_obj = calloc(1, sizeof(*event_obj)); if(!event_obj) return NULL; @@ -968,8 +968,8 @@ static ULONG WINAPI DOMEvent_Release(IDOMEvent *iface) IEventTarget_Release(&This->target->IEventTarget_iface); nsIDOMEvent_Release(This->nsevent); release_dispex(&This->dispex); - heap_free(This->type); - heap_free(This); + free(This->type); + free(This); } return ref; @@ -1116,8 +1116,8 @@ static HRESULT WINAPI DOMEvent_initEvent(IDOMEvent *iface, BSTR type, VARIANT_BO return S_OK; } - heap_free(This->type); - This->type = heap_strdupW(type); + free(This->type); + This->type = wcsdup(type); if(!This->type) return E_OUTOFMEMORY; This->event_id = str_to_eid(type); @@ -3004,7 +3004,7 @@ dispex_static_data_t DOMStorageEvent_dispex = { static void *event_ctor(unsigned size, dispex_static_data_t *dispex_data, void *(*query_interface)(DOMEvent*,REFIID), void (*destroy)(DOMEvent*), nsIDOMEvent *nsevent, eventid_t event_id, compat_mode_t compat_mode) { - DOMEvent *event = heap_alloc_zero(size); + DOMEvent *event = calloc(1, size); if(!event) return NULL; @@ -3014,9 +3014,9 @@ static void *event_ctor(unsigned size, dispex_static_data_t *dispex_data, void * event->ref = 1; event->event_id = event_id; if(event_id != EVENTID_LAST) { - event->type = heap_strdupW(event_info[event_id].name); + event->type = wcsdup(event_info[event_id].name); if(!event->type) { - heap_free(event); + free(event); return NULL; } event->bubbles = (event_info[event_id].flags & EVENT_BUBBLES) != 0; @@ -3463,12 +3463,12 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp if(listeners_cnt == listeners_size) { event_listener_t *new_listeners; if(listeners == listeners_buf) { - new_listeners = heap_alloc(listeners_size * 2 * sizeof(*new_listeners)); + new_listeners = malloc(listeners_size * 2 * sizeof(*new_listeners)); if(!new_listeners) break; memcpy(new_listeners, listeners, listeners_cnt * sizeof(*listeners)); }else { - new_listeners = heap_realloc(listeners, listeners_size * 2 * sizeof(*new_listeners)); + new_listeners = realloc(listeners, listeners_size * 2 * sizeof(*new_listeners)); } listeners = new_listeners; listeners_size *= 2; @@ -3543,7 +3543,7 @@ static void call_event_handlers(EventTarget *event_target, DOMEvent *event, disp for(listener = listeners; listener < listeners + listeners_cnt; listener++) IDispatch_Release(listener->function); if(listeners != listeners_buf) - heap_free(listeners); + free(listeners); if(event->phase != DEP_CAPTURING_PHASE && event_info[event->event_id].dispid && (vtbl = dispex_get_vtbl(&event_target->dispex)) && vtbl->get_cp_container) @@ -3624,12 +3624,12 @@ static HRESULT dispatch_event_object(EventTarget *event_target, DOMEvent *event, if(chain_cnt == chain_buf_size) { EventTarget **new_chain; if(target_chain == target_chain_buf) { - new_chain = heap_alloc(chain_buf_size * 2 * sizeof(*new_chain)); + new_chain = malloc(chain_buf_size * 2 * sizeof(*new_chain)); if(!new_chain) break; memcpy(new_chain, target_chain, chain_buf_size * sizeof(*new_chain)); }else { - new_chain = heap_realloc(target_chain, chain_buf_size * 2 * sizeof(*new_chain)); + new_chain = realloc(target_chain, chain_buf_size * 2 * sizeof(*new_chain)); if(!new_chain) break; } @@ -3708,7 +3708,7 @@ static HRESULT dispatch_event_object(EventTarget *event_target, DOMEvent *event, for(i = 0; i < chain_cnt; i++) IEventTarget_Release(&target_chain[i]->IEventTarget_iface); if(target_chain != target_chain_buf) - heap_free(target_chain); + free(target_chain); return S_OK; } @@ -3863,7 +3863,7 @@ static event_listener_t *get_onevent_listener(EventTarget *event_target, eventid if(!alloc) return NULL; - listener = heap_alloc(sizeof(*listener)); + listener = malloc(sizeof(*listener)); if(!listener) return NULL; @@ -4008,7 +4008,7 @@ HRESULT attach_event(EventTarget *event_target, BSTR name, IDispatch *disp, VARI if(!container) return E_OUTOFMEMORY; - listener = heap_alloc(sizeof(*listener)); + listener = malloc(sizeof(*listener)); if(!listener) return E_OUTOFMEMORY; @@ -4147,7 +4147,7 @@ HRESULT doc_init_events(HTMLDocumentNode *doc) unsigned i; HRESULT hres; - doc->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL)); + doc->event_vector = calloc(EVENTID_LAST, sizeof(BOOL)); if(!doc->event_vector) return E_OUTOFMEMORY; @@ -4240,7 +4240,7 @@ static HRESULT WINAPI EventTarget_addEventListener(IEventTarget *iface, BSTR typ return S_OK; } - listener = heap_alloc(sizeof(*listener)); + listener = malloc(sizeof(*listener)); if(!listener) return E_OUTOFMEMORY; @@ -4408,8 +4408,8 @@ void release_event_target(EventTarget *event_target) if(listener->function) IDispatch_Release(listener->function); list_remove(&listener->entry); - heap_free(listener); + free(listener); } - heap_free(iter); + free(iter); } } diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index d6e4b2d8424..3e7ca112311 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -161,7 +161,7 @@ static ULONG WINAPI HTMLFormElementEnum_Release(IEnumVARIANT *iface) if(!ref) { IHTMLFormElement_Release(&This->elem->IHTMLFormElement_iface); - heap_free(This); + free(This); } return ref; @@ -687,7 +687,7 @@ static HRESULT WINAPI HTMLFormElement__newEnum(IHTMLFormElement *iface, IUnknown TRACE("(%p)->(%p)\n", This, p); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -1018,7 +1018,7 @@ HRESULT HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTM HTMLFormElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLFormElement)); + ret = calloc(1, sizeof(HTMLFormElement)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index a93460829fd..ffd8156a9ef 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -1048,7 +1048,7 @@ HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT { HTMLFrameElement *ret; - ret = heap_alloc_zero(sizeof(HTMLFrameElement)); + ret = calloc(1, sizeof(HTMLFrameElement)); if(!ret) return E_OUTOFMEMORY; @@ -1643,7 +1643,7 @@ HRESULT HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElem { HTMLIFrame *ret; - ret = heap_alloc_zero(sizeof(HTMLIFrame)); + ret = calloc(1, sizeof(HTMLIFrame)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlgeneric.c b/dlls/mshtml/htmlgeneric.c index 459fc78266b..9244ba017fb 100644 --- a/dlls/mshtml/htmlgeneric.c +++ b/dlls/mshtml/htmlgeneric.c @@ -179,7 +179,7 @@ HRESULT HTMLGenericElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, { HTMLGenericElement *ret; - ret = heap_alloc_zero(sizeof(HTMLGenericElement)); + ret = calloc(1, sizeof(HTMLGenericElement)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlhead.c b/dlls/mshtml/htmlhead.c index 9460d186e58..072efd967b9 100644 --- a/dlls/mshtml/htmlhead.c +++ b/dlls/mshtml/htmlhead.c @@ -194,7 +194,7 @@ HRESULT HTMLTitleElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT { HTMLTitleElement *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -379,7 +379,7 @@ HRESULT HTMLHtmlElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTM { HTMLHtmlElement *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -616,7 +616,7 @@ HRESULT HTMLMetaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTM { HTMLMetaElement *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -780,7 +780,7 @@ HRESULT HTMLHeadElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTM { HTMLHeadElement *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index e779dd2dec7..713cb157512 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -756,7 +756,7 @@ HRESULT HTMLImgElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTML HTMLImg *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLImg)); + ret = calloc(1, sizeof(HTMLImg)); if(!ret) return E_OUTOFMEMORY; @@ -818,7 +818,7 @@ static ULONG WINAPI HTMLImageElementFactory_Release(IHTMLImageElementFactory *if TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -999,7 +999,7 @@ HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow *window, HTMLImageElement { HTMLImageElementFactory *ret; - ret = heap_alloc(sizeof(HTMLImageElementFactory)); + ret = malloc(sizeof(HTMLImageElementFactory)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index bd71cea88bd..b9e527eac3b 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -1454,7 +1454,7 @@ HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT HTMLInputElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLInputElement)); + ret = calloc(1, sizeof(HTMLInputElement)); if(!ret) return E_OUTOFMEMORY; @@ -1650,7 +1650,7 @@ HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT { HTMLLabelElement *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -1999,7 +1999,7 @@ HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H HTMLButtonElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmllink.c b/dlls/mshtml/htmllink.c index 190d2a6bdb4..124507a2fc9 100644 --- a/dlls/mshtml/htmllink.c +++ b/dlls/mshtml/htmllink.c @@ -459,7 +459,7 @@ HRESULT HTMLLinkElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTM HTMLLinkElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 26365a7a5d0..d0abb42f2b2 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -124,7 +124,7 @@ static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface) if(This->window) This->window->location = NULL; release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -201,7 +201,7 @@ static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p) case INTERNET_SCHEME_FILE: { /* prepend a slash */ - url_path = HeapAlloc(GetProcessHeap(), 0, (url.dwUrlPathLength + 1) * sizeof(WCHAR)); + url_path = malloc((url.dwUrlPathLength + 1) * sizeof(WCHAR)); if(!url_path) return E_OUTOFMEMORY; url_path[0] = '/'; @@ -216,7 +216,7 @@ static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p) case INTERNET_SCHEME_FTP: if(!url.dwUrlPathLength) { /* add a slash if it's blank */ - url_path = url.lpszUrlPath = HeapAlloc(GetProcessHeap(), 0, 1 * sizeof(WCHAR)); + url_path = url.lpszUrlPath = malloc(sizeof(WCHAR)); if(!url.lpszUrlPath) return E_OUTOFMEMORY; url.lpszUrlPath[0] = '/'; @@ -247,7 +247,7 @@ static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p) } SetLastError(0); - buf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + buf = malloc(len * sizeof(WCHAR)); if(!buf) { ret = E_OUTOFMEMORY; goto cleanup; @@ -269,8 +269,8 @@ static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p) ret = S_OK; cleanup: - HeapFree(GetProcessHeap(), 0, buf); - HeapFree(GetProcessHeap(), 0, url_path); + free(buf); + free(url_path); return ret; } @@ -536,7 +536,7 @@ static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v) if(hash[0] != '#') { unsigned size = (1 /* # */ + wcslen(v) + 1) * sizeof(WCHAR); - if(!(hash = heap_alloc(size))) + if(!(hash = malloc(size))) return E_OUTOFMEMORY; hash[0] = '#'; memcpy(hash + 1, v, size - sizeof(WCHAR)); @@ -545,7 +545,7 @@ static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v) hres = navigate_url(This->window->base.outer_window, hash, This->window->base.outer_window->uri, BINDING_NAVIGATED); if(hash != v) - heap_free(hash); + free(hash); return hres; } @@ -663,7 +663,7 @@ HRESULT HTMLLocation_Create(HTMLInnerWindow *window, HTMLLocation **ret) { HTMLLocation *location; - location = heap_alloc(sizeof(*location)); + location = malloc(sizeof(*location)); if(!location) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index a293b332a9f..5d70b09e234 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -99,7 +99,7 @@ static ULONG WINAPI HTMLDOMChildrenCollectionEnum_Release(IEnumVARIANT *iface) if(!ref) { IHTMLDOMChildrenCollection_Release(&This->col->IHTMLDOMChildrenCollection_iface); - heap_free(This); + free(This); } return ref; @@ -241,7 +241,7 @@ static ULONG WINAPI HTMLDOMChildrenCollection_Release(IHTMLDOMChildrenCollection if(!ref) { nsIDOMNodeList_Release(This->nslist); - heap_free(This); + free(This); } return ref; @@ -296,7 +296,7 @@ static HRESULT WINAPI HTMLDOMChildrenCollection_get__newEnum(IHTMLDOMChildrenCol TRACE("(%p)->(%p)\n", This, p); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -456,7 +456,7 @@ HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mod { HTMLDOMChildrenCollection *collection; - if(!(collection = heap_alloc_zero(sizeof(*collection)))) + if(!(collection = calloc(1, sizeof(*collection)))) return E_OUTOFMEMORY; collection->IHTMLDOMChildrenCollection_iface.lpVtbl = &HTMLDOMChildrenCollectionVtbl; @@ -1552,7 +1552,7 @@ static HRESULT create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNod FIXME("unimplemented node type %u\n", node_type); - node = heap_alloc_zero(sizeof(HTMLDOMNode)); + node = calloc(1, sizeof(HTMLDOMNode)); if(!node) return E_OUTOFMEMORY; @@ -1624,7 +1624,7 @@ static void NSAPI HTMLDOMNode_delete_cycle_collectable(void *p) This->vtbl->unlink(This); This->vtbl->destructor(This); release_dispex(&This->event_target.dispex); - heap_free(This); + free(This); } void init_node_cc(void) diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index 1ad907338e7..9e30b5426fb 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -788,7 +788,7 @@ HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H HTMLObjectElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -1050,7 +1050,7 @@ HRESULT HTMLEmbedElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT { HTMLEmbed *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c index efacefaaaf4..2ef21fbfb0a 100644 --- a/dlls/mshtml/htmlscript.c +++ b/dlls/mshtml/htmlscript.c @@ -382,7 +382,7 @@ static HRESULT HTMLScriptElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) static void HTMLScriptElement_destructor(HTMLDOMNode *iface) { HTMLScriptElement *This = impl_from_HTMLDOMNode(iface); - heap_free(This->src_text); + free(This->src_text); HTMLElement_destructor(&This->element.node); } @@ -492,7 +492,7 @@ HRESULT HTMLScriptElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H HTMLScriptElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLScriptElement)); + ret = calloc(1, sizeof(HTMLScriptElement)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index 95bddb3c7e7..f0ebfd16d11 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -429,7 +429,7 @@ HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H HTMLOptionElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLOptionElement)); + ret = calloc(1, sizeof(HTMLOptionElement)); if(!ret) return E_OUTOFMEMORY; @@ -494,7 +494,7 @@ static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory * if(!ref) { release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -652,7 +652,7 @@ HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionEleme { HTMLOptionElementFactory *ret; - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -768,7 +768,7 @@ static ULONG WINAPI HTMLSelectElementEnum_Release(IEnumVARIANT *iface) if(!ref) { IHTMLSelectElement_Release(&This->elem->IHTMLSelectElement_iface); - heap_free(This); + free(This); } return ref; @@ -1260,7 +1260,7 @@ static HRESULT WINAPI HTMLSelectElement_get__newEnum(IHTMLSelectElement *iface, TRACE("(%p)->(%p)\n", This, p); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -1507,7 +1507,7 @@ HRESULT HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, H HTMLSelectElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLSelectElement)); + ret = calloc(1, sizeof(HTMLSelectElement)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index d8ecf573b2b..9a883e4bc05 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -100,7 +100,7 @@ static struct session_map_entry *grab_session_map_entry(BSTR origin) } origin_len = SysStringLen(origin); - entry = heap_alloc(FIELD_OFFSET(struct session_map_entry, origin[origin_len])); + entry = malloc(FIELD_OFFSET(struct session_map_entry, origin[origin_len])); if(!entry) return NULL; wine_rb_init(&entry->data_map, session_entry_cmp); @@ -121,7 +121,7 @@ static void release_session_map_entry(struct session_map_entry *entry) return; wine_rb_remove(&get_thread_data(FALSE)->session_storage_map, &entry->entry); - heap_free(entry); + free(entry); } static HRESULT get_session_entry(struct session_map_entry *entry, const WCHAR *name, BOOL create, struct session_entry **ret) @@ -145,7 +145,7 @@ static HRESULT get_session_entry(struct session_map_entry *entry, const WCHAR *n key_len = wcslen(key); if(entry->quota < key_len) return E_OUTOFMEMORY; /* native returns this when quota is exceeded */ - if(!(data = heap_alloc(FIELD_OFFSET(struct session_entry, key[key_len + 1])))) + if(!(data = malloc(FIELD_OFFSET(struct session_entry, key[key_len + 1])))) return E_OUTOFMEMORY; data->value = NULL; memcpy(data->key, key, (key_len + 1) * sizeof(WCHAR)); @@ -164,7 +164,7 @@ static void clear_session_storage(struct session_map_entry *entry) LIST_FOR_EACH_ENTRY_SAFE(iter, iter2, &entry->data_list, struct session_entry, list_entry) { SysFreeString(iter->value); - heap_free(iter); + free(iter); } wine_rb_destroy(&entry->data_map, NULL, NULL); list_init(&entry->data_list); @@ -178,7 +178,7 @@ void destroy_session_storage(thread_data_t *thread_data) WINE_RB_FOR_EACH_ENTRY_DESTRUCTOR(iter, iter2, &thread_data->session_storage_map, struct session_map_entry, entry) { clear_session_storage(iter); - heap_free(iter); + free(iter); } } @@ -189,7 +189,7 @@ static void release_props(HTMLStorage *This) SysFreeString(*prop); prop++; } - heap_free(This->props); + free(This->props); } static inline HTMLStorage *impl_from_IHTMLStorage(IHTMLStorage *iface) @@ -248,7 +248,7 @@ static HRESULT push_storage_event_task(struct send_storage_event_ctx *ctx, HTMLI if(FAILED(hres)) return hres; - if(!(task = heap_alloc(sizeof(*task)))) { + if(!(task = malloc(sizeof(*task)))) { IDOMEvent_Release(&event->IDOMEvent_iface); return E_OUTOFMEMORY; } @@ -404,10 +404,10 @@ static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface) if(!ref) { release_session_map_entry(This->session_storage); release_dispex(&This->dispex); - heap_free(This->filename); + free(This->filename); CloseHandle(This->mutex); release_props(This); - heap_free(This); + free(This); } return ref; @@ -451,7 +451,7 @@ static BOOL create_path(const WCHAR *path) WCHAR *new_path; int len; - new_path = heap_alloc((wcslen(path) + 1) * sizeof(WCHAR)); + new_path = malloc((wcslen(path) + 1) * sizeof(WCHAR)); if(!new_path) return FALSE; wcscpy(new_path, path); @@ -480,7 +480,7 @@ static BOOL create_path(const WCHAR *path) } new_path[len] = '\\'; } - heap_free(new_path); + free(new_path); return ret; } @@ -492,7 +492,7 @@ static HRESULT open_document(const WCHAR *filename, IXMLDOMDocument **ret) VARIANT var; VARIANT_BOOL success; - path = heap_strdupW(filename); + path = wcsdup(filename); if(!path) return E_OUTOFMEMORY; @@ -533,7 +533,7 @@ static HRESULT open_document(const WCHAR *filename, IXMLDOMDocument **ret) SysFreeString(V_BSTR(&var)); done: - heap_free(path); + free(path); if(hres == S_OK) *ret = doc; else if(doc) @@ -1006,7 +1006,7 @@ static HRESULT WINAPI HTMLStorage_removeItem(IHTMLStorage *iface, BSTR bstrKey) list_remove(&session_entry->list_entry); wine_rb_remove(&This->session_storage->data_map, &session_entry->entry); old_value = session_entry->value; - heap_free(session_entry); + free(session_entry); hres = send_storage_event(This, bstrKey, old_value, NULL); } @@ -1119,7 +1119,7 @@ static HRESULT get_prop(HTMLStorage *This, const WCHAR *name, DISPID *dispid) } if(is_power_of_2(This->num_props)) { - BSTR *new_props = heap_realloc(This->props, max(This->num_props * 2 * sizeof(BSTR*), 1)); + BSTR *new_props = realloc(This->props, max(This->num_props * 2 * sizeof(BSTR*), 1)); if(!new_props) return E_OUTOFMEMORY; This->props = new_props; @@ -1397,7 +1397,7 @@ static WCHAR *build_filename(BSTR hostname) memcpy(path + len, store, sizeof(store)); len += ARRAY_SIZE(store); - ret = heap_alloc((len + wcslen(hostname) + ARRAY_SIZE(L".xml")) * sizeof(WCHAR)); + ret = malloc((len + wcslen(hostname) + ARRAY_SIZE(L".xml")) * sizeof(WCHAR)); if(!ret) { return NULL; } @@ -1412,7 +1412,7 @@ static WCHAR *build_filename(BSTR hostname) static WCHAR *build_mutexname(const WCHAR *filename) { WCHAR *ret, *ptr; - ret = heap_strdupW(filename); + ret = wcsdup(filename); if(!ret) return NULL; for(ptr = ret; *ptr; ptr++) @@ -1436,7 +1436,7 @@ HRESULT create_html_storage(HTMLInnerWindow *window, BOOL local, IHTMLStorage ** return hres; } - storage = heap_alloc_zero(sizeof(*storage)); + storage = calloc(1, sizeof(*storage)); if(!storage) { SysFreeString(hostname); return E_OUTOFMEMORY; @@ -1447,33 +1447,33 @@ HRESULT create_html_storage(HTMLInnerWindow *window, BOOL local, IHTMLStorage ** storage->filename = build_filename(hostname); SysFreeString(hostname); if(!storage->filename) { - heap_free(storage); + free(storage); return E_OUTOFMEMORY; } mutexname = build_mutexname(storage->filename); if(!mutexname) { - heap_free(storage->filename); - heap_free(storage); + free(storage->filename); + free(storage); return E_OUTOFMEMORY; } storage->mutex = CreateMutexW(NULL, FALSE, mutexname); - heap_free(mutexname); + free(mutexname); if(!storage->mutex) { - heap_free(storage->filename); - heap_free(storage); + free(storage->filename); + free(storage); return HRESULT_FROM_WIN32(GetLastError()); } }else { hres = build_session_origin(uri, hostname, &origin); SysFreeString(hostname); if(hres != S_OK) { - heap_free(storage); + free(storage); return hres; } storage->session_storage = grab_session_map_entry(origin); SysFreeString(origin); if(!storage->session_storage) { - heap_free(storage); + free(storage); return E_OUTOFMEMORY; } } diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 44ac21c5f97..703fbeeb942 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -745,7 +745,7 @@ static void fix_px_value(nsAString *nsstr) LPWSTR ret, p; int len = lstrlenW(val)+1; - ret = heap_alloc((len+2)*sizeof(WCHAR)); + ret = malloc((len + 2) * sizeof(WCHAR)); memcpy(ret, val, (ptr-val)*sizeof(WCHAR)); p = ret + (ptr-val); *p++ = 'p'; @@ -755,7 +755,7 @@ static void fix_px_value(nsAString *nsstr) TRACE("fixed %s -> %s\n", debugstr_w(val), debugstr_w(ret)); nsAString_SetData(nsstr, ret); - heap_free(ret); + free(ret); break; } @@ -773,7 +773,7 @@ static LPWSTR fix_url_value(LPCWSTR val) if(wcsncmp(val, urlW, ARRAY_SIZE(urlW)) || !wcschr(val, '\\')) return NULL; - ret = heap_strdupW(val); + ret = wcsdup(val); for(ptr = ret; *ptr; ptr++) { if(*ptr == '\\') @@ -844,7 +844,7 @@ static inline HRESULT set_style_property(CSSStyle *style, styleid_t sid, const W fix_px_value(&value_str); hres = set_nsstyle_property(style->nsstyle, sid, &value_str); nsAString_Finish(&value_str); - heap_free(val); + free(val); return hres; } @@ -2857,12 +2857,12 @@ static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v) } if(v) { - new_filter = heap_strdupW(v); + new_filter = wcsdup(v); if(!new_filter) return E_OUTOFMEMORY; } - heap_free(This->elem->filter); + free(This->elem->filter); This->elem->filter = new_filter; update_filter(This); @@ -3006,7 +3006,7 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri if(!This->elem) return E_UNEXPECTED; *pfSuccess = variant_bool(This->elem->filter && *This->elem->filter); - heap_free(This->elem->filter); + free(This->elem->filter); This->elem->filter = NULL; update_filter(This); return S_OK; @@ -4776,7 +4776,7 @@ static ULONG WINAPI HTMLCSSStyleDeclaration_Release(IHTMLCSSStyleDeclaration *if if(This->nsstyle) nsIDOMCSSStyleDeclaration_Release(This->nsstyle); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -5130,7 +5130,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_backgroundPositionX(IHTMLCSSSt } posy_len = lstrlenW(posy); - pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR)); + pos_val = malloc((val_len + posy_len + 1) * sizeof(WCHAR)); if(pos_val) { if(val_len) memcpy(pos_val, val, val_len*sizeof(WCHAR)); @@ -5148,7 +5148,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_backgroundPositionX(IHTMLCSSSt TRACE("setting position to %s\n", debugstr_w(pos_val)); hres = set_style_property(This, STYLEID_BACKGROUND_POSITION, pos_val); - heap_free(pos_val); + free(pos_val); return hres; } @@ -5227,7 +5227,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_backgroundPositionY(IHTMLCSSSt posx_len = space-pos; - pos_val = heap_alloc((posx_len+val_len+1)*sizeof(WCHAR)); + pos_val = malloc((posx_len + val_len + 1) * sizeof(WCHAR)); if(pos_val) { memcpy(pos_val, pos, posx_len*sizeof(WCHAR)); if(val_len) @@ -5244,7 +5244,7 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_put_backgroundPositionY(IHTMLCSSSt TRACE("setting position to %s\n", debugstr_w(pos_val)); hres = set_style_property(This, STYLEID_BACKGROUND_POSITION, pos_val); - heap_free(pos_val); + free(pos_val); return hres; } @@ -10082,7 +10082,7 @@ HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret) if(FAILED(hres)) return hres; - style = heap_alloc_zero(sizeof(HTMLStyle)); + style = calloc(1, sizeof(HTMLStyle)); if(!style) { nsIDOMCSSStyleDeclaration_Release(nsstyle); return E_OUTOFMEMORY; @@ -10119,7 +10119,7 @@ HRESULT create_computed_style(nsIDOMCSSStyleDeclaration *nsstyle, compat_mode_t { CSSStyle *style; - if(!(style = heap_alloc_zero(sizeof(*style)))) + if(!(style = calloc(1, sizeof(*style)))) return E_OUTOFMEMORY; init_css_style(style, nsstyle, NULL, &HTMLW3CComputedStyle_dispex, compat_mode); diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c index eee854d7e44..abd720cc18f 100644 --- a/dlls/mshtml/htmlstyleelem.c +++ b/dlls/mshtml/htmlstyleelem.c @@ -475,7 +475,7 @@ HRESULT HTMLStyleElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HT HTMLStyleElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c index 8546a5c9519..59680d720e2 100644 --- a/dlls/mshtml/htmlstylesheet.c +++ b/dlls/mshtml/htmlstylesheet.c @@ -127,7 +127,7 @@ static ULONG WINAPI HTMLStyleSheetRule_Release(IHTMLStyleSheetRule *iface) release_dispex(&This->dispex); if(This->nsstylesheetrule) nsIDOMCSSRule_Release(This->nsstylesheetrule); - heap_free(This); + free(This); } return ref; @@ -223,7 +223,7 @@ static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, compat_m HTMLStyleSheetRule *rule; nsresult nsres; - if(!(rule = heap_alloc(sizeof(*rule)))) + if(!(rule = malloc(sizeof(*rule)))) return E_OUTOFMEMORY; rule->IHTMLStyleSheetRule_iface.lpVtbl = &HTMLStyleSheetRuleVtbl; @@ -294,7 +294,7 @@ static ULONG WINAPI HTMLStyleSheetRulesCollection_Release(IHTMLStyleSheetRulesCo release_dispex(&This->dispex); if(This->nslist) nsIDOMCSSRuleList_Release(This->nslist); - heap_free(This); + free(This); } return ref; @@ -487,7 +487,7 @@ static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, co { HTMLStyleSheetRulesCollection *collection; - if(!(collection = heap_alloc(sizeof(*collection)))) + if(!(collection = malloc(sizeof(*collection)))) return E_OUTOFMEMORY; collection->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl; @@ -548,7 +548,7 @@ static ULONG WINAPI HTMLStyleSheetsCollectionEnum_Release(IEnumVARIANT *iface) if(!ref) { IHTMLStyleSheetsCollection_Release(&This->col->IHTMLStyleSheetsCollection_iface); - heap_free(This); + free(This); } return ref; @@ -679,7 +679,7 @@ static ULONG WINAPI HTMLStyleSheetsCollection_Release(IHTMLStyleSheetsCollection release_dispex(&This->dispex); if(This->nslist) nsIDOMStyleSheetList_Release(This->nslist); - heap_free(This); + free(This); } return ref; @@ -739,7 +739,7 @@ static HRESULT WINAPI HTMLStyleSheetsCollection_get__newEnum(IHTMLStyleSheetsCol TRACE("(%p)->(%p)\n", This, p); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -914,7 +914,7 @@ HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, compat_mode_ { HTMLStyleSheetsCollection *collection; - if(!(collection = heap_alloc(sizeof(HTMLStyleSheetsCollection)))) + if(!(collection = malloc(sizeof(HTMLStyleSheetsCollection)))) return E_OUTOFMEMORY; collection->IHTMLStyleSheetsCollection_iface.lpVtbl = &HTMLStyleSheetsCollectionVtbl; @@ -983,7 +983,7 @@ static ULONG WINAPI HTMLStyleSheet_Release(IHTMLStyleSheet *iface) release_dispex(&This->dispex); if(This->nsstylesheet) nsIDOMCSSStyleSheet_Release(This->nsstylesheet); - heap_free(This); + free(This); } return ref; @@ -1147,7 +1147,7 @@ static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSe lIndex = length; len = ARRAY_SIZE(format) - 4 /* %s twice */ + wcslen(bstrSelector) + wcslen(bstrStyle); - if(!(rule = heap_alloc(len * sizeof(WCHAR)))) + if(!(rule = malloc(len * sizeof(WCHAR)))) return E_OUTOFMEMORY; swprintf(rule, len, format, bstrSelector, bstrStyle); @@ -1155,7 +1155,7 @@ static HRESULT WINAPI HTMLStyleSheet_addRule(IHTMLStyleSheet *iface, BSTR bstrSe nsres = nsIDOMCSSStyleSheet_InsertRule(This->nsstylesheet, &nsstr, lIndex, &new_index); if(NS_FAILED(nsres)) WARN("failed: %08lx\n", nsres); nsAString_Finish(&nsstr); - heap_free(rule); + free(rule); *plIndex = new_index; return map_nsresult(nsres); @@ -1485,7 +1485,7 @@ HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_ HTMLStyleSheet *style_sheet; nsresult nsres; - if(!(style_sheet = heap_alloc(sizeof(HTMLStyleSheet)))) + if(!(style_sheet = malloc(sizeof(HTMLStyleSheet)))) return E_OUTOFMEMORY; style_sheet->IHTMLStyleSheet_iface.lpVtbl = &HTMLStyleSheetVtbl; diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index f489d7592e7..1afb32ea6ec 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -533,7 +533,7 @@ HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLE HTMLTableCell *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -979,7 +979,7 @@ HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLEl HTMLTableRow *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLTableRow)); + ret = calloc(1, sizeof(HTMLTableRow)); if(!ret) return E_OUTOFMEMORY; @@ -2013,7 +2013,7 @@ HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLEleme HTMLTable *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLTable)); + ret = calloc(1, sizeof(HTMLTable)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c index cb79fc17d29..5820c0c7291 100644 --- a/dlls/mshtml/htmltextarea.c +++ b/dlls/mshtml/htmltextarea.c @@ -492,7 +492,7 @@ HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLTextAreaElement *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(HTMLTextAreaElement)); + ret = calloc(1, sizeof(HTMLTextAreaElement)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 373515be444..a09c0758452 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -378,7 +378,7 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDO HTMLDOMTextNode *ret; nsresult nsres; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index ec7fc0d43f2..044d3bc8371 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -246,7 +246,7 @@ static void release_outer_window(HTMLOuterWindow *This) mozIDOMWindowProxy_Release(This->window_proxy); wine_rb_remove(&window_map, &This->entry); - heap_free(This); + free(This); } static void release_inner_window(HTMLInnerWindow *This) @@ -266,8 +266,8 @@ static void release_inner_window(HTMLInnerWindow *This) release_dispex(&This->event_target.dispex); for(i=0; i < This->global_prop_cnt; i++) - heap_free(This->global_props[i].name); - heap_free(This->global_props); + free(This->global_props[i].name); + free(This->global_props); if(This->location) { This->location->window = NULL; @@ -314,7 +314,7 @@ static void release_inner_window(HTMLInnerWindow *This) if(This->mon) IMoniker_Release(This->mon); - heap_free(This); + free(This); } static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) @@ -649,7 +649,7 @@ static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message) len = SysStringLen(message); if(len > MAX_MESSAGE_LEN) { - msg = heap_alloc((MAX_MESSAGE_LEN+1)*sizeof(WCHAR)); + msg = malloc((MAX_MESSAGE_LEN + 1) * sizeof(WCHAR)); if(!msg) return E_OUTOFMEMORY; memcpy(msg, message, MAX_MESSAGE_LEN*sizeof(WCHAR)); @@ -658,7 +658,7 @@ static HRESULT WINAPI HTMLWindow2_alert(IHTMLWindow2 *iface, BSTR message) MessageBoxW(This->outer_window->browser->doc->hwnd, msg, title, MB_ICONWARNING); if(msg != message) - heap_free(msg); + free(msg); return S_OK; } @@ -3295,7 +3295,7 @@ static HRESULT WINAPI window_private_postMessage(IWineHTMLWindowPrivate *iface, if(dispex_compat_mode(&window->event_target.dispex) >= COMPAT_MODE_IE9) { struct post_message_task *task; - if(!(task = heap_alloc(sizeof(*task)))) { + if(!(task = malloc(sizeof(*task)))) { IDOMEvent_Release(&event->IDOMEvent_iface); return E_OUTOFMEMORY; } @@ -3515,10 +3515,10 @@ static global_prop_t *alloc_global_prop(HTMLInnerWindow *This, global_prop_type_ if(This->global_props) { new_size = This->global_prop_size*2; - new_props = heap_realloc(This->global_props, new_size*sizeof(global_prop_t)); + new_props = realloc(This->global_props, new_size * sizeof(global_prop_t)); }else { new_size = 16; - new_props = heap_alloc(new_size*sizeof(global_prop_t)); + new_props = malloc(new_size * sizeof(global_prop_t)); } if(!new_props) return NULL; @@ -3526,7 +3526,7 @@ static global_prop_t *alloc_global_prop(HTMLInnerWindow *This, global_prop_type_ This->global_prop_size = new_size; } - This->global_props[This->global_prop_cnt].name = heap_strdupW(name); + This->global_props[This->global_prop_cnt].name = wcsdup(name); if(!This->global_props[This->global_prop_cnt].name) return NULL; @@ -4031,7 +4031,7 @@ static void *alloc_window(size_t size) { HTMLWindow *window; - window = heap_alloc_zero(size); + window = calloc(1, size); if(!window) return NULL; @@ -4065,7 +4065,7 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon, hres = create_performance_timing(&window->performance_timing); if(FAILED(hres)) { - heap_free(window); + free(window); return hres; } diff --git a/dlls/mshtml/ifacewrap.c b/dlls/mshtml/ifacewrap.c index 502ba80604a..c4cc773d024 100644 --- a/dlls/mshtml/ifacewrap.c +++ b/dlls/mshtml/ifacewrap.c @@ -78,7 +78,7 @@ static ULONG WINAPI wrapper_Release(IUnknown *iface) if(!ref) { IUnknown_Release(This->iface); IUnknown_Release(This->ref_unk); - heap_free(This); + free(This); } return ref; @@ -327,7 +327,7 @@ HRESULT wrap_iface(IUnknown *iface, IUnknown *ref_unk, IUnknown **ret) { iface_wrapper_t *wrapper; - wrapper = heap_alloc(sizeof(*wrapper)); + wrapper = malloc(sizeof(*wrapper)); if(!wrapper) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/loadopts.c b/dlls/mshtml/loadopts.c index 7bea46924ed..5237e22f1aa 100644 --- a/dlls/mshtml/loadopts.c +++ b/dlls/mshtml/loadopts.c @@ -101,11 +101,11 @@ static ULONG WINAPI HtmlLoadOptions_Release(IHtmlLoadOptions *iface) last = iter; iter = iter->next; - heap_free(last->buffer); - heap_free(last); + free(last->buffer); + free(last); } - heap_free(This); + free(This); } return ref; @@ -154,13 +154,13 @@ static HRESULT WINAPI HtmlLoadOptions_SetOption(IHtmlLoadOptions *iface, DWORD d } if(!iter) { - iter = heap_alloc(sizeof(load_opt)); + iter = malloc(sizeof(load_opt)); iter->next = This->opts; This->opts = iter; iter->option = dwOption; }else { - heap_free(iter->buffer); + free(iter->buffer); } if(!cbBuf) { @@ -171,7 +171,7 @@ static HRESULT WINAPI HtmlLoadOptions_SetOption(IHtmlLoadOptions *iface, DWORD d } iter->size = cbBuf; - iter->buffer = heap_alloc(cbBuf); + iter->buffer = malloc(cbBuf); memcpy(iter->buffer, pBuffer, iter->size); return S_OK; @@ -192,7 +192,7 @@ HRESULT HTMLLoadOptions_Create(IUnknown *pUnkOuter, REFIID riid, void** ppv) TRACE("(%p %s %p)\n", pUnkOuter, debugstr_mshtml_guid(riid), ppv); - ret = heap_alloc(sizeof(HTMLLoadOptions)); + ret = malloc(sizeof(HTMLLoadOptions)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/main.c b/dlls/mshtml/main.c index af3e9fc30e9..14c34f2f36a 100644 --- a/dlls/mshtml/main.c +++ b/dlls/mshtml/main.c @@ -142,18 +142,18 @@ HRESULT get_mime_type_display_name(const WCHAR *content_type, BSTR *ret) if(!GetMIMETypeSubKeyW(content_type, buffer, ARRAY_SIZE(buffer))) { len = wcslen(content_type) + 32; for(;;) { - if(!(str = heap_alloc(len * sizeof(WCHAR)))) + if(!(str = malloc(len * sizeof(WCHAR)))) return E_OUTOFMEMORY; if(GetMIMETypeSubKeyW(content_type, str, len)) break; - heap_free(str); + free(str); len *= 2; } } status = RegOpenKeyExW(HKEY_CLASSES_ROOT, str, 0, KEY_QUERY_VALUE, &key); if(str != buffer) - heap_free(str); + free(str); if(status != ERROR_SUCCESS) goto fail; @@ -183,7 +183,7 @@ HRESULT get_mime_type_display_name(const WCHAR *content_type, BSTR *ret) if(hres == S_OK && len) break; if(str != buffer) - heap_free(str); + free(str); if(hres != E_POINTER) { if(progid != ext) { CoTaskMemFree(progid); @@ -208,7 +208,7 @@ HRESULT get_mime_type_display_name(const WCHAR *content_type, BSTR *ret) str = buffer; continue; } - str = heap_alloc(len * sizeof(WCHAR)); + str = malloc(len * sizeof(WCHAR)); } if(progid != ext) CoTaskMemFree(progid); @@ -216,7 +216,7 @@ HRESULT get_mime_type_display_name(const WCHAR *content_type, BSTR *ret) *ret = SysAllocString(str); if(str != buffer) - heap_free(str); + free(str); return *ret ? S_OK : E_OUTOFMEMORY; fail: @@ -290,7 +290,7 @@ static BOOL WINAPI load_compat_settings(INIT_ONCE *once, void *param, void **con } name_size = lstrlenW(key_name) + 1; - new_entry = heap_alloc(FIELD_OFFSET(compat_config_t, host[name_size])); + new_entry = malloc(FIELD_OFFSET(compat_config_t, host[name_size])); if(!new_entry) continue; @@ -360,14 +360,14 @@ static void thread_detach(void) DestroyWindow(thread_data->thread_hwnd); destroy_session_storage(thread_data); - heap_free(thread_data); + free(thread_data); } static void free_strings(void) { unsigned int i; for(i = 0; i < ARRAY_SIZE(status_strings); i++) - heap_free(status_strings[i]); + free(status_strings[i]); } static void process_detach(void) @@ -380,7 +380,7 @@ static void process_detach(void) while(!list_empty(&compat_config)) { config = LIST_ENTRY(list_head(&compat_config), compat_config_t, entry); list_remove(&config->entry); - heap_free(config); + free(config); } if(shdoclc) @@ -406,11 +406,11 @@ void set_statustext(HTMLDocumentObj* doc, INT id, LPCWSTR arg) if(!p) { len = 255; - p = heap_alloc(len * sizeof(WCHAR)); + p = malloc(len * sizeof(WCHAR)); len = LoadStringW(hInst, id, p, len) + 1; - p = heap_realloc(p, len * sizeof(WCHAR)); + p = realloc(p, len * sizeof(WCHAR)); if(InterlockedCompareExchangePointer((void**)&status_strings[index], p, NULL)) { - heap_free(p); + free(p); p = status_strings[index]; } } @@ -419,7 +419,7 @@ void set_statustext(HTMLDocumentObj* doc, INT id, LPCWSTR arg) WCHAR *buf; len = lstrlenW(p) + lstrlenW(arg) - 1; - buf = heap_alloc(len * sizeof(WCHAR)); + buf = malloc(len * sizeof(WCHAR)); swprintf(buf, len, p, arg); @@ -429,7 +429,7 @@ void set_statustext(HTMLDocumentObj* doc, INT id, LPCWSTR arg) IOleInPlaceFrame_SetStatusText(doc->frame, p); if(arg) - heap_free(p); + free(p); } HRESULT do_query_service(IUnknown *unk, REFGUID guid_service, REFIID riid, void **ppv) @@ -515,7 +515,7 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) TRACE("(%p) ref = %lu\n", This, ref); if(!ref) { - heap_free(This); + free(This); } return ref; @@ -546,7 +546,7 @@ static const IClassFactoryVtbl HTMLClassFactoryVtbl = { static HRESULT ClassFactory_Create(REFIID riid, void **ppv, CreateInstanceFunc fnCreateInstance) { - ClassFactory *ret = heap_alloc(sizeof(ClassFactory)); + ClassFactory *ret = malloc(sizeof(ClassFactory)); HRESULT hres; ret->IClassFactory_iface.lpVtbl = &HTMLClassFactoryVtbl; @@ -555,7 +555,7 @@ static HRESULT ClassFactory_Create(REFIID riid, void **ppv, CreateInstanceFunc f hres = IClassFactory_QueryInterface(&ret->IClassFactory_iface, riid, ppv); if(FAILED(hres)) { - heap_free(ret); + free(ret); *ppv = NULL; } return hres; @@ -732,7 +732,7 @@ static HRESULT register_server(BOOL do_register) INF_SET_ID(LIBID_MSHTML); for(i=0; i < ARRAY_SIZE(pse); i++) { - pse[i].pszValue = heap_alloc(39); + pse[i].pszValue = malloc(39); sprintf(pse[i].pszValue, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0], clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4], @@ -750,7 +750,7 @@ static HRESULT register_server(BOOL do_register) FreeLibrary(hAdvpack); for(i=0; i < ARRAY_SIZE(pse); i++) - heap_free(pse[i].pszValue); + free(pse[i].pszValue); if(FAILED(hres)) ERR("RegInstall failed: %08lx\n", hres); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c5c3549ce71..804db0b1bdf 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -30,7 +30,6 @@ #include "tlogstg.h" #include "shdeprecated.h" -#include "wine/heap.h" #include "wine/list.h" #include "wine/rbtree.h" @@ -1334,33 +1333,12 @@ DEFINE_GUID(IID_IDispatchJS,0x719c3050,0xf9d3,0x11cf,0xa4,0x93,0x00,0x40,0x05,0x /* memory allocation functions */ -static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len) -{ - return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len); -} - -static inline LPWSTR heap_strdupW(LPCWSTR str) +static inline WCHAR *strndupW(LPCWSTR str, unsigned len) { LPWSTR ret = NULL; if(str) { - DWORD size; - - size = (lstrlenW(str)+1)*sizeof(WCHAR); - ret = heap_alloc(size); - if(ret) - memcpy(ret, str, size); - } - - return ret; -} - -static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len) -{ - LPWSTR ret = NULL; - - if(str) { - ret = heap_alloc((len+1)*sizeof(WCHAR)); + ret = malloc((len + 1) * sizeof(WCHAR)); if(ret) { memcpy(ret, str, len*sizeof(WCHAR)); @@ -1371,23 +1349,7 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len) return ret; } -static inline char *heap_strdupA(const char *str) -{ - char *ret = NULL; - - if(str) { - DWORD size; - - size = strlen(str)+1; - ret = heap_alloc(size); - if(ret) - memcpy(ret, str, size); - } - - return ret; -} - -static inline WCHAR *heap_strdupAtoW(const char *str) +static inline WCHAR *strdupAtoW(const char *str) { LPWSTR ret = NULL; @@ -1395,7 +1357,7 @@ static inline WCHAR *heap_strdupAtoW(const char *str) DWORD len; len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - ret = heap_alloc(len*sizeof(WCHAR)); + ret = malloc(len * sizeof(WCHAR)); if(ret) MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); } @@ -1403,13 +1365,13 @@ static inline WCHAR *heap_strdupAtoW(const char *str) return ret; } -static inline char *heap_strdupWtoA(LPCWSTR str) +static inline char *strdupWtoA(const WCHAR *str) { char *ret = NULL; if(str) { DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); - ret = heap_alloc(size); + ret = malloc(size); if(ret) WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL); } @@ -1417,7 +1379,7 @@ static inline char *heap_strdupWtoA(LPCWSTR str) return ret; } -static inline WCHAR *heap_strdupUtoW(const char *str) +static inline WCHAR *strdupUtoW(const char *str) { WCHAR *ret = NULL; @@ -1425,7 +1387,7 @@ static inline WCHAR *heap_strdupUtoW(const char *str) size_t len; len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); - ret = heap_alloc(len*sizeof(WCHAR)); + ret = malloc(len * sizeof(WCHAR)); if(ret) MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len); } @@ -1433,13 +1395,13 @@ static inline WCHAR *heap_strdupUtoW(const char *str) return ret; } -static inline char *heap_strdupWtoU(const WCHAR *str) +static inline char *strdupWtoU(const WCHAR *str) { char *ret = NULL; if(str) { size_t size = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL); - ret = heap_alloc(size); + ret = malloc(size); if(ret) WideCharToMultiByte(CP_UTF8, 0, str, -1, ret, size, NULL, NULL); } @@ -1447,14 +1409,14 @@ static inline char *heap_strdupWtoU(const WCHAR *str) return ret; } -static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len) +static inline char *strndupWtoU(const WCHAR *str, unsigned len) { char *ret = NULL; DWORD size; if(str) { size = len ? WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL) : 0; - ret = heap_alloc(size + 1); + ret = malloc(size + 1); if(ret) { if(len) WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL); ret[size] = '\0'; diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c index a311c2a0ba8..d7167ebe2da 100644 --- a/dlls/mshtml/mutation.c +++ b/dlls/mshtml/mutation.c @@ -175,7 +175,7 @@ static PRUnichar *handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar * return NULL; } - buf = heap_alloc((end-ptr+1)*sizeof(WCHAR)); + buf = malloc((end - ptr + 1) * sizeof(WCHAR)); if(!buf) return NULL; @@ -212,7 +212,7 @@ static nsresult run_insert_comment(HTMLDocumentNode *doc, nsISupports *comment_i HRESULT hres; hres = replace_node_by_html(doc->dom_document, (nsIDOMNode*)nscomment, replace_html); - heap_free(replace_html); + free(replace_html); if(FAILED(hres)) nsres = NS_ERROR_FAILURE; } @@ -361,7 +361,7 @@ static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_ifa if(!iter->script->parsed) doc_insert_script(window, iter->script, TRUE); IHTMLScriptElement_Release(&iter->script->IHTMLScriptElement_iface); - heap_free(iter); + free(iter); } IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); @@ -504,12 +504,12 @@ void process_document_response_headers(HTMLDocumentNode *doc, IBinding *binding) TRACE("size %lu\n", size); - header = heap_strdupAtoW(buf); + header = strdupAtoW(buf); if(header && parse_ua_compatible(header, &document_mode)) { TRACE("setting document mode %d\n", document_mode); set_document_mode(doc, document_mode, FALSE); } - heap_free(header); + free(header); } IWinInetHttpInfo_Release(http_info); @@ -612,7 +612,7 @@ static nsrefcnt NSAPI nsRunnable_Release(nsIRunnable *iface) nsISupports_Release(This->arg1); if(This->arg2) nsISupports_Release(This->arg2); - heap_free(This); + free(This); } return ref; @@ -636,7 +636,7 @@ static void add_script_runner(HTMLDocumentNode *This, runnable_proc_t proc, nsIS { nsRunnable *runnable; - runnable = heap_alloc_zero(sizeof(*runnable)); + runnable = calloc(1, sizeof(*runnable)); if(!runnable) return; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 469bd0d1e07..ae8ec72fd9d 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -102,7 +102,7 @@ static nsrefcnt NSAPI nsInputStream_Release(nsIInputStream *iface) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -193,7 +193,7 @@ static nsProtocolStream *create_nsprotocol_stream(void) { nsProtocolStream *ret; - ret = heap_alloc(sizeof(nsProtocolStream)); + ret = malloc(sizeof(nsProtocolStream)); if(!ret) return NULL; @@ -208,7 +208,7 @@ static void release_request_data(request_data_t *request_data) { if(request_data->post_stream) nsIInputStream_Release(request_data->post_stream); - heap_free(request_data->headers); + free(request_data->headers); if(request_data->post_data) GlobalFree(request_data->post_data); } @@ -724,8 +724,8 @@ static void parse_content_type(nsChannelBSC *This, const WCHAR *value) if(!iswspace(*beg)) break; - if((content_type = heap_strndupWtoU(beg, end - beg))) { - heap_free(This->nschannel->content_type); + if((content_type = strndupWtoU(beg, end - beg))) { + free(This->nschannel->content_type); This->nschannel->content_type = content_type; strlwr(content_type); } @@ -757,7 +757,7 @@ static void parse_content_type(nsChannelBSC *This, const WCHAR *value) } lena = WideCharToMultiByte(CP_ACP, 0, charset, charset_len, NULL, 0, NULL, NULL); - charseta = heap_alloc(lena+1); + charseta = malloc(lena + 1); if(!charseta) return; @@ -767,7 +767,7 @@ static void parse_content_type(nsChannelBSC *This, const WCHAR *value) nsACString_InitDepend(&charset_str, charseta); nsIHttpChannel_SetContentCharset(&This->nschannel->nsIHttpChannel_iface, &charset_str); nsACString_Finish(&charset_str); - heap_free(charseta); + free(charseta); }else { FIXME("unhandled: %s\n", debugstr_wn(ptr, len - (ptr-value))); } @@ -833,13 +833,13 @@ static void query_http_info(nsChannelBSC *This, IWinInetHttpInfo *wininet_info) if(!len) return; - buf = heap_alloc(len); + buf = malloc(len); if(!buf) return; IWinInetHttpInfo_QueryInfo(wininet_info, HTTP_QUERY_RAW_HEADERS_CRLF, buf, &len, NULL, NULL); if(!len) { - heap_free(buf); + free(buf); return; } @@ -849,7 +849,7 @@ static void query_http_info(nsChannelBSC *This, IWinInetHttpInfo *wininet_info) process_response_headers(This, ptr); } - heap_free(buf); + free(buf); } HRESULT start_binding(HTMLInnerWindow *inner_window, BSCallback *bscallback, IBindCtx *bctx) @@ -938,7 +938,7 @@ static HRESULT read_post_data_stream(nsIInputStream *stream, BOOL contains_heade data_len -= post_data-data; size = MultiByteToWideChar(CP_ACP, 0, data, ptr-data, NULL, 0); - headers = heap_alloc((size+1)*sizeof(WCHAR)); + headers = malloc((size + 1) * sizeof(WCHAR)); if(headers) { MultiByteToWideChar(CP_ACP, 0, data, ptr-data, headers, size); headers[size] = 0; @@ -947,7 +947,7 @@ static HRESULT read_post_data_stream(nsIInputStream *stream, BOOL contains_heade if(SUCCEEDED(hres)) request_data->headers = headers; else - heap_free(headers); + free(headers); }else { hres = E_OUTOFMEMORY; } @@ -1152,10 +1152,10 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream) if(first_read) { switch(This->bsc.bom) { case BOM_UTF8: - This->nschannel->charset = heap_strdupA(UTF8_STR); + This->nschannel->charset = strdup(UTF8_STR); break; case BOM_UTF16: - This->nschannel->charset = heap_strdupA(UTF16_STR); + This->nschannel->charset = strdup(UTF16_STR); case BOM_NONE: /* FIXME: Get charset from HTTP headers */; } @@ -1170,7 +1170,7 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream) TRACE("Found MIME %s\n", debugstr_w(mime)); - This->nschannel->content_type = heap_strdupWtoA(mime); + This->nschannel->content_type = strdupWtoA(mime); CoTaskMemFree(mime); if(!This->nschannel->content_type) return E_OUTOFMEMORY; @@ -1256,7 +1256,7 @@ static nsrefcnt NSAPI nsAsyncVerifyRedirectCallback_Release(nsIAsyncVerifyRedire if(!ref) { IBindStatusCallback_Release(&This->bsc->bsc.IBindStatusCallback_iface); nsIHttpChannel_Release(&This->nschannel->nsIHttpChannel_iface); - heap_free(This); + free(This); } return ref; @@ -1316,7 +1316,7 @@ static HRESULT create_redirect_callback(nsChannel *nschannel, nsChannelBSC *bsc, { nsRedirectCallback *callback; - callback = heap_alloc(sizeof(*callback)); + callback = malloc(sizeof(*callback)); if(!callback) return E_OUTOFMEMORY; @@ -1353,7 +1353,7 @@ static void nsChannelBSC_destroy(BSCallback *bsc) nsISupports_Release(This->nscontext); if(This->nsstream) nsIInputStream_Release(&This->nsstream->nsIInputStream_iface); - heap_free(This); + free(This); } static HRESULT nsChannelBSC_start_binding(BSCallback *bsc) @@ -1412,7 +1412,7 @@ static void stop_request_task_destr(task_t *_task) stop_request_task_t *task = (stop_request_task_t*)_task; IBindStatusCallback_Release(&task->bsc->bsc.IBindStatusCallback_iface); - heap_free(task); + free(task); } static HRESULT async_stop_request(nsChannelBSC *This) @@ -1424,7 +1424,7 @@ static HRESULT async_stop_request(nsChannelBSC *This) on_start_nsrequest(This); } - task = heap_alloc(sizeof(*task)); + task = malloc(sizeof(*task)); if(!task) return E_OUTOFMEMORY; @@ -1603,7 +1603,7 @@ static BOOL is_supported_doc_mime(const WCHAR *mime) char *nscat, *mimea; BOOL ret; - mimea = heap_strdupWtoA(mime); + mimea = strdupWtoA(mime); if(!mimea) return FALSE; @@ -1611,7 +1611,7 @@ static BOOL is_supported_doc_mime(const WCHAR *mime) ret = nscat != NULL && !strcmp(nscat, "@mozilla.org/content/document-loader-factory;1"); - heap_free(mimea); + free(mimea); nsfree(nscat); return ret; } @@ -1719,8 +1719,8 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG progress, ULONG t (This->nschannel->content_type && !(This->nschannel->load_flags & LOAD_CALL_CONTENT_SNIFFERS))) return S_OK; - heap_free(This->nschannel->content_type); - This->nschannel->content_type = heap_strdupWtoA(status_text); + free(This->nschannel->content_type); + This->nschannel->content_type = strdupWtoA(status_text); break; case BINDSTATUS_REDIRECTING: if(This->is_doc_channel && !This->bsc.window->performance_timing->redirect_time) @@ -1777,7 +1777,7 @@ static HRESULT process_response_status_text(const WCHAR *header, const WCHAR *he else ++header; - *status_text = heap_strndupWtoU(header, header_end - header); + *status_text = strndupWtoU(header, header_end - header); if(!*status_text) return E_OUTOFMEMORY; @@ -1808,7 +1808,7 @@ static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code, return hres; } - heap_free(This->nschannel->response_status_text); + free(This->nschannel->response_status_text); This->nschannel->response_status_text = str; if(headers && headers[1] == '\n') { @@ -1887,7 +1887,7 @@ HRESULT create_channelbsc(IMoniker *mon, const WCHAR *headers, BYTE *post_data, nsChannelBSC *ret; DWORD bindf; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -1899,7 +1899,7 @@ HRESULT create_channelbsc(IMoniker *mon, const WCHAR *headers, BYTE *post_data, ret->is_doc_channel = is_doc_binding; if(headers) { - ret->bsc.request_data.headers = heap_strdupW(headers); + ret->bsc.request_data.headers = wcsdup(headers); if(!ret->bsc.request_data.headers) { IBindStatusCallback_Release(&ret->bsc.IBindStatusCallback_iface); return E_OUTOFMEMORY; @@ -1943,7 +1943,7 @@ static void start_doc_binding_task_destr(task_t *_task) start_doc_binding_task_t *task = (start_doc_binding_task_t*)_task; IHTMLWindow2_Release(&task->pending_window->base.IHTMLWindow2_iface); - heap_free(task); + free(task); } HRESULT async_start_doc_binding(HTMLOuterWindow *window, HTMLInnerWindow *pending_window) @@ -1952,7 +1952,7 @@ HRESULT async_start_doc_binding(HTMLOuterWindow *window, HTMLInnerWindow *pendin TRACE("%p\n", pending_window); - task = heap_alloc(sizeof(start_doc_binding_task_t)); + task = malloc(sizeof(start_doc_binding_task_t)); if(!task) return E_OUTOFMEMORY; @@ -2009,7 +2009,7 @@ HRESULT channelbsc_load_stream(HTMLInnerWindow *pending_window, IMoniker *mon, I return E_FAIL; } - bscallback->nschannel->content_type = heap_strdupA("text/html"); + bscallback->nschannel->content_type = strdup("text/html"); if(!bscallback->nschannel->content_type) return E_OUTOFMEMORY; @@ -2043,7 +2043,7 @@ void channelbsc_set_channel(nsChannelBSC *This, nsChannel *channel, nsIStreamLis HRESULT hres; hres = parse_headers(This->bsc.request_data.headers, &channel->request_headers); - heap_free(This->bsc.request_data.headers); + free(This->bsc.request_data.headers); This->bsc.request_data.headers = NULL; if(FAILED(hres)) WARN("parse_headers failed: %08lx\n", hres); @@ -2099,7 +2099,7 @@ static void navigate_javascript_task_destr(task_t *_task) navigate_javascript_task_t *task = (navigate_javascript_task_t*)_task; IUri_Release(task->uri); - heap_free(task); + free(task); } typedef struct { @@ -2131,7 +2131,7 @@ static void navigate_task_destr(task_t *_task) IBindStatusCallback_Release(&task->bscallback->bsc.IBindStatusCallback_iface); IMoniker_Release(task->mon); IUri_Release(task->uri); - heap_free(task); + free(task); } static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri) @@ -2169,7 +2169,7 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri) * while Gecko scrolls only to elements with "hash" ids. We scroll the page ourselves if * a[id="#hash"] element can be found. */ - selector = heap_alloc(sizeof(selector_formatW)+SysStringLen(frag)*sizeof(WCHAR)); + selector = malloc(sizeof(selector_formatW) + SysStringLen(frag) * sizeof(WCHAR)); if(selector) { nsIDOMElement *nselem = NULL; nsAString selector_str; @@ -2179,7 +2179,7 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri) /* NOTE: Gecko doesn't set result to NULL if there is no match, so nselem must be initialized */ nsres = nsIDOMDocument_QuerySelector(window->base.inner_window->doc->dom_document, &selector_str, &nselem); nsAString_Finish(&selector_str); - heap_free(selector); + free(selector); if(NS_SUCCEEDED(nsres) && nselem) { nsIDOMHTMLElement *html_elem; @@ -2272,7 +2272,7 @@ HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, DWORD flags, const WC IBindStatusCallback_Release(&bsc->bsc.IBindStatusCallback_iface); IMoniker_Release(mon); - task = heap_alloc(sizeof(*task)); + task = malloc(sizeof(*task)); if(!task) return E_OUTOFMEMORY; @@ -2294,7 +2294,7 @@ HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, DWORD flags, const WC }else { navigate_task_t *task; - task = heap_alloc(sizeof(*task)); + task = malloc(sizeof(*task)); if(!task) { IBindStatusCallback_Release(&bsc->bsc.IBindStatusCallback_iface); IMoniker_Release(mon); diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index e720884bcc6..66dd3f1d65e 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -157,7 +157,7 @@ static nsrefcnt NSAPI nsSingletonEnumerator_Release(nsISimpleEnumerator *iface) if(!ref) { if(This->value) nsISupports_Release(This->value); - heap_free(This); + free(This); } return ref; @@ -199,7 +199,7 @@ static nsISimpleEnumerator *create_singleton_enumerator(nsISupports *value) { nsSingletonEnumerator *ret; - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return NULL; @@ -415,7 +415,7 @@ static BOOL install_wine_gecko(void) len = GetSystemDirectoryW(app, MAX_PATH-ARRAY_SIZE(controlW)); memcpy(app+len, controlW, sizeof(controlW)); - args = heap_alloc(len*sizeof(WCHAR) + sizeof(controlW) + sizeof(argsW)); + args = malloc(len * sizeof(WCHAR) + sizeof(controlW) + sizeof(argsW)); if(!args) return FALSE; @@ -427,7 +427,7 @@ static BOOL install_wine_gecko(void) memset(&si, 0, sizeof(si)); si.cb = sizeof(si); ret = CreateProcessW(app, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); - heap_free(args); + free(args); if (ret) { CloseHandle(pi.hThread); WaitForSingleObject(pi.hProcess, INFINITE); @@ -460,7 +460,7 @@ static void set_environment(LPCWSTR gre_path) len = GetEnvironmentVariableW(L"PATH", NULL, 0); gre_path_len = lstrlenW(gre_path); - path = heap_alloc((len+gre_path_len+1)*sizeof(WCHAR)); + path = malloc((len + gre_path_len + 1) * sizeof(WCHAR)); if(!path) return; GetEnvironmentVariableW(L"PATH", path, len); @@ -474,7 +474,7 @@ static void set_environment(LPCWSTR gre_path) lstrcpyW(path+len, gre_path); SetEnvironmentVariableW(L"PATH", path); } - heap_free(path); + free(path); } static void set_bool_pref(nsIPrefBranch *pref, const char *pref_name, BOOL val) @@ -664,7 +664,7 @@ static WCHAR *check_version(const WCHAR *path) } len = wcslen(path); - file_name = heap_alloc((len + 12) * sizeof(WCHAR)); + file_name = malloc((len + 12) * sizeof(WCHAR)); if(!file_name) return NULL; @@ -677,7 +677,7 @@ static WCHAR *check_version(const WCHAR *path) file_name[len] = 0; if(hfile == INVALID_HANDLE_VALUE) { TRACE("%s not found\n", debugstr_w(file_name)); - heap_free(file_name); + free(file_name); return NULL; } @@ -690,7 +690,7 @@ static WCHAR *check_version(const WCHAR *path) if(strcmp(version, GECKO_VERSION_STRING)) { ERR("Unexpected version %s, expected \"%s\"\n", debugstr_a(version), GECKO_VERSION_STRING); - heap_free(file_name); + free(file_name); return NULL; } @@ -717,11 +717,11 @@ static WCHAR *find_wine_gecko_reg(void) return check_version(buffer); } -static WCHAR *heap_strcat(const WCHAR *str1, const WCHAR *str2) +static WCHAR *strdupWW(const WCHAR *str1, const WCHAR *str2) { size_t len1 = lstrlenW(str1); size_t len2 = lstrlenW(str2); - WCHAR *ret = heap_alloc((len1 + len2 + 1) * sizeof(WCHAR)); + WCHAR *ret = malloc((len1 + len2 + 1) * sizeof(WCHAR)); if(!ret) return NULL; memcpy(ret, str1, len1 * sizeof(WCHAR)); memcpy(ret + len1, str2, len2 * sizeof(WCHAR)); @@ -735,14 +735,14 @@ static WCHAR *find_wine_gecko_datadir(void) WCHAR *path = NULL, *ret; if((data_dir = _wgetenv(L"WINEDATADIR"))) - path = heap_strcat(data_dir, L"\\gecko\\" GECKO_DIR_NAME); + path = strdupWW(data_dir, L"\\gecko\\" GECKO_DIR_NAME); else if((data_dir = _wgetenv(L"WINEBUILDDIR"))) - path = heap_strcat(data_dir, L"\\..\\gecko\\" GECKO_DIR_NAME); + path = strdupWW(data_dir, L"\\..\\gecko\\" GECKO_DIR_NAME); if(!path) return NULL; ret = check_version(path); - heap_free(path); + free(path); return ret; } @@ -763,7 +763,7 @@ static WCHAR *find_wine_gecko_unix(const char *unix_path) ret = check_version(dos_dir); - heap_free(dos_dir); + free(dos_dir); return ret; } @@ -811,7 +811,7 @@ BOOL load_gecko(void) if(gecko_path) { ret = load_xul(gecko_path); - heap_free(gecko_path); + free(gecko_path); }else { MESSAGE("Could not find Wine Gecko. HTML rendering will be disabled.\n"); } @@ -1290,7 +1290,7 @@ BOOL is_gecko_path(const char *path) WCHAR *buf, *ptr; BOOL ret; - buf = heap_strdupUtoW(path); + buf = strdupUtoW(path); if(!buf || lstrlenW(buf) < gecko_path_len) return FALSE; @@ -1303,7 +1303,7 @@ BOOL is_gecko_path(const char *path) buf[gecko_path_len] = 0; ret = !wcsicmp(buf, gecko_path); - heap_free(buf); + free(buf); return ret; } @@ -1405,7 +1405,7 @@ static nsrefcnt NSAPI nsWeakReference_Release(nsIWeakReference *iface) if(!ref) { assert(!This->browser); - heap_free(This); + free(This); } return ref; @@ -1503,7 +1503,7 @@ static nsrefcnt NSAPI nsWebBrowserChrome_Release(nsIWebBrowserChrome *iface) This->weak_reference->browser = NULL; nsIWeakReference_Release(&This->weak_reference->nsIWeakReference_iface); } - heap_free(This); + free(This); } return ref; @@ -2152,7 +2152,7 @@ static nsresult NSAPI nsSupportsWeakReference_GetWeakReference(nsISupportsWeakRe TRACE("(%p)->(%p)\n", This, _retval); if(!This->weak_reference) { - This->weak_reference = heap_alloc(sizeof(nsWeakReference)); + This->weak_reference = malloc(sizeof(nsWeakReference)); if(!This->weak_reference) return NS_ERROR_OUT_OF_MEMORY; @@ -2299,7 +2299,7 @@ HRESULT create_gecko_browser(HTMLDocumentObj *doc, GeckoBrowser **_ret) if(!load_gecko()) return CLASS_E_CLASSNOTAVAILABLE; - ret = heap_alloc_zero(sizeof(GeckoBrowser)); + ret = calloc(1, sizeof(GeckoBrowser)); if(!ret) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index b0f55dfe35f..3bc5dc5baa2 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -100,7 +100,7 @@ static LONG release_listener(nsDocumentEventListener *This) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -604,7 +604,7 @@ void init_nsevents(HTMLDocumentNode *doc) nsIDOMEventTarget *target; unsigned i; - listener = heap_alloc(sizeof(nsDocumentEventListener)); + listener = malloc(sizeof(nsDocumentEventListener)); if(!listener) return; diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 6654018f8e6..7799083f616 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -179,7 +179,7 @@ static nsresult return_wstr_nsacstr(nsACString *ret_str, const WCHAR *str, int l } lena = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL); - stra = heap_alloc(lena+1); + stra = malloc(lena + 1); if(!stra) return NS_ERROR_OUT_OF_MEMORY; @@ -187,7 +187,7 @@ static nsresult return_wstr_nsacstr(nsACString *ret_str, const WCHAR *str, int l stra[lena] = 0; nsACString_SetData(ret_str, stra); - heap_free(stra); + free(stra); return NS_OK; } @@ -369,22 +369,22 @@ static nsresult get_channel_http_header(struct list *headers, const nsACString * char *data; nsACString_GetData(header_name_str, &header_namea); - header_name = heap_strdupAtoW(header_namea); + header_name = strdupAtoW(header_namea); if(!header_name) return NS_ERROR_UNEXPECTED; header = find_http_header(headers, header_name, lstrlenW(header_name)); - heap_free(header_name); + free(header_name); if(!header) return NS_ERROR_NOT_AVAILABLE; - data = heap_strdupWtoA(header->data); + data = strdupWtoA(header->data); if(!data) return NS_ERROR_UNEXPECTED; TRACE("%s -> %s\n", debugstr_a(header_namea), debugstr_a(data)); nsACString_SetData(_retval, data); - heap_free(data); + free(data); return NS_OK; } @@ -399,23 +399,23 @@ HRESULT set_http_header(struct list *headers, const WCHAR *name, int name_len, if(header) { WCHAR *new_data; - new_data = heap_strndupW(value, value_len); + new_data = strndupW(value, value_len); if(!new_data) return E_OUTOFMEMORY; - heap_free(header->data); + free(header->data); header->data = new_data; }else { - header = heap_alloc(sizeof(http_header_t)); + header = malloc(sizeof(http_header_t)); if(!header) return E_OUTOFMEMORY; - header->header = heap_strndupW(name, name_len); - header->data = heap_strndupW(value, value_len); + header->header = strndupW(name, name_len); + header->data = strndupW(value, value_len); if(!header->header || !header->data) { - heap_free(header->header); - heap_free(header->data); - heap_free(header); + free(header->header); + free(header->data); + free(header); return E_OUTOFMEMORY; } @@ -433,21 +433,21 @@ static nsresult set_channel_http_header(struct list *headers, const nsACString * HRESULT hres; nsACString_GetData(name_str, &namea); - name = heap_strdupAtoW(namea); + name = strdupAtoW(namea); if(!name) return NS_ERROR_UNEXPECTED; nsACString_GetData(value_str, &valuea); - value = heap_strdupAtoW(valuea); + value = strdupAtoW(valuea); if(!value) { - heap_free(name); + free(name); return NS_ERROR_UNEXPECTED; } hres = set_http_header(headers, name, lstrlenW(name), value, lstrlenW(value)); - heap_free(name); - heap_free(value); + free(name); + free(value); return SUCCEEDED(hres) ? NS_OK : NS_ERROR_UNEXPECTED; } @@ -459,13 +459,13 @@ static nsresult visit_http_headers(struct list *headers, nsIHttpHeaderVisitor *v nsresult nsres; LIST_FOR_EACH_ENTRY(iter, headers, http_header_t, entry) { - header = heap_strdupWtoA(iter->header); + header = strdupWtoA(iter->header); if(!header) return NS_ERROR_OUT_OF_MEMORY; - value = heap_strdupWtoA(iter->data); + value = strdupWtoA(iter->data); if(!value) { - heap_free(header); + free(header); return NS_ERROR_OUT_OF_MEMORY; } @@ -474,8 +474,8 @@ static nsresult visit_http_headers(struct list *headers, nsIHttpHeaderVisitor *v nsres = nsIHttpHeaderVisitor_VisitHeader(visitor, &header_str, &value_str); nsACString_Finish(&header_str); nsACString_Finish(&value_str); - heap_free(header); - heap_free(value); + free(header); + free(value); if(NS_FAILED(nsres)) break; } @@ -489,9 +489,9 @@ static void free_http_headers(struct list *list) LIST_FOR_EACH_ENTRY_SAFE(iter, iter_next, list, http_header_t, entry) { list_remove(&iter->entry); - heap_free(iter->header); - heap_free(iter->data); - heap_free(iter); + free(iter->header); + free(iter->data); + free(iter); } } @@ -574,9 +574,9 @@ static nsrefcnt NSAPI nsChannel_Release(nsIHttpChannel *iface) free_http_headers(&This->response_headers); free_http_headers(&This->request_headers); - heap_free(This->content_type); - heap_free(This->charset); - heap_free(This); + free(This->content_type); + free(This->charset); + free(This); } return ref; @@ -828,8 +828,8 @@ static nsresult NSAPI nsChannel_SetContentType(nsIHttpChannel *iface, TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aContentType)); nsACString_GetData(aContentType, &content_type); - heap_free(This->content_type); - This->content_type = heap_strdupA(content_type); + free(This->content_type); + This->content_type = strdup(content_type); return NS_OK; } @@ -860,11 +860,11 @@ static nsresult NSAPI nsChannel_SetContentCharset(nsIHttpChannel *iface, TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aContentCharset)); nsACString_GetData(aContentCharset, &data); - charset = heap_strdupA(data); + charset = strdup(data); if(!charset) return NS_ERROR_OUT_OF_MEMORY; - heap_free(This->charset); + free(This->charset); This->charset = charset; return NS_OK; } @@ -979,7 +979,7 @@ static void start_binding_task_destr(task_t *_task) start_binding_task_t *task = (start_binding_task_t*)_task; IBindStatusCallback_Release(&task->bscallback->bsc.IBindStatusCallback_iface); - heap_free(task); + free(task); } static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc_channel, nsIStreamListener *listener, @@ -1015,7 +1015,7 @@ static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc }else { start_binding_task_t *task; - task = heap_alloc(sizeof(start_binding_task_t)); + task = malloc(sizeof(start_binding_task_t)); if(!task) { IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface); return NS_ERROR_OUT_OF_MEMORY; @@ -1081,8 +1081,8 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen nsres = NS_BINDING_ABORTED; } }else if(window->browser->doc->mime) { - heap_free(This->content_type); - This->content_type = heap_strdupWtoA(window->browser->doc->mime); + free(This->content_type); + This->content_type = strdupWtoA(window->browser->doc->mime); } } } @@ -1675,12 +1675,12 @@ static nsresult NSAPI nsUploadChannel_SetUploadStream(nsIUploadChannel *iface, if(*content_type) { WCHAR *ct; - ct = heap_strdupAtoW(content_type); + ct = strdupAtoW(content_type); if(!ct) return NS_ERROR_UNEXPECTED; set_http_header(&This->request_headers, content_typeW, ARRAY_SIZE(content_typeW), ct, lstrlenW(ct)); - heap_free(ct); + free(ct); This->post_data_contains_headers = FALSE; } } @@ -2296,14 +2296,14 @@ static nsresult get_uri_string(nsWineURI *This, Uri_PROPERTY prop, nsACString *r return NS_ERROR_UNEXPECTED; } - vala = heap_strdupWtoU(hres == S_OK ? val : NULL); + vala = strdupWtoU(hres == S_OK ? val : NULL); SysFreeString(val); if(hres == S_OK && !vala) return NS_ERROR_OUT_OF_MEMORY; TRACE("ret %s\n", debugstr_a(vala)); nsACString_SetData(ret, vala); - heap_free(vala); + free(vala); return NS_OK; } @@ -2372,7 +2372,7 @@ static nsrefcnt NSAPI nsURI_Release(nsIFileURL *iface) IUri_Release(This->uri); if(This->uri_builder) IUriBuilder_Release(This->uri_builder); - heap_free(This); + free(This); } return ref; @@ -2401,12 +2401,12 @@ static nsresult NSAPI nsURI_SetSpec(nsIFileURL *iface, const nsACString *aSpec) return NS_ERROR_UNEXPECTED; nsACString_GetData(aSpec, &speca); - spec = heap_strdupUtoW(speca); + spec = strdupUtoW(speca); if(!spec) return NS_ERROR_OUT_OF_MEMORY; hres = create_uri(spec, 0, &uri); - heap_free(spec); + free(spec); if(FAILED(hres)) { WARN("create_uri failed: %08lx\n", hres); return NS_ERROR_FAILURE; @@ -2501,12 +2501,12 @@ static nsresult NSAPI nsURI_SetScheme(nsIFileURL *iface, const nsACString *aSche return NS_ERROR_UNEXPECTED; nsACString_GetData(aScheme, &schemea); - scheme = heap_strdupUtoW(schemea); + scheme = strdupUtoW(schemea); if(!scheme) return NS_ERROR_OUT_OF_MEMORY; hres = IUriBuilder_SetSchemeName(This->uri_builder, scheme); - heap_free(scheme); + free(scheme); if(FAILED(hres)) return NS_ERROR_UNEXPECTED; @@ -2561,7 +2561,7 @@ static nsresult NSAPI nsURI_SetUserPass(nsIFileURL *iface, const nsACString *aUs if(*user_pass) { WCHAR *ptr; - buf = heap_strdupUtoW(user_pass); + buf = strdupUtoW(user_pass); if(!buf) return NS_ERROR_OUT_OF_MEMORY; @@ -2582,7 +2582,7 @@ static nsresult NSAPI nsURI_SetUserPass(nsIFileURL *iface, const nsACString *aUs if(SUCCEEDED(hres)) hres = IUriBuilder_SetPassword(This->uri_builder, pass); - heap_free(buf); + free(buf); return SUCCEEDED(hres) ? NS_OK : NS_ERROR_FAILURE; } @@ -2608,12 +2608,12 @@ static nsresult NSAPI nsURI_SetUsername(nsIFileURL *iface, const nsACString *aUs return NS_ERROR_UNEXPECTED; nsACString_GetData(aUsername, &usera); - user = heap_strdupUtoW(usera); + user = strdupUtoW(usera); if(!user) return NS_ERROR_OUT_OF_MEMORY; hres = IUriBuilder_SetUserName(This->uri_builder, user); - heap_free(user); + free(user); if(FAILED(hres)) return NS_ERROR_UNEXPECTED; @@ -2642,12 +2642,12 @@ static nsresult NSAPI nsURI_SetPassword(nsIFileURL *iface, const nsACString *aPa return NS_ERROR_UNEXPECTED; nsACString_GetData(aPassword, &passa); - pass = heap_strdupUtoW(passa); + pass = strdupUtoW(passa); if(!pass) return NS_ERROR_OUT_OF_MEMORY; hres = IUriBuilder_SetPassword(This->uri_builder, pass); - heap_free(pass); + free(pass); if(FAILED(hres)) return NS_ERROR_UNEXPECTED; @@ -2678,14 +2678,14 @@ static nsresult NSAPI nsURI_GetHostPort(nsIFileURL *iface, nsACString *aHostPort if(!ptr) ptr = val; } - vala = heap_strdupWtoU(ptr); + vala = strdupWtoU(ptr); SysFreeString(val); if(hres == S_OK && !vala) return NS_ERROR_OUT_OF_MEMORY; TRACE("ret %s\n", debugstr_a(vala)); nsACString_SetData(aHostPort, vala); - heap_free(vala); + free(vala); return NS_OK; } @@ -2721,12 +2721,12 @@ static nsresult NSAPI nsURI_SetHost(nsIFileURL *iface, const nsACString *aHost) return NS_ERROR_UNEXPECTED; nsACString_GetData(aHost, &hosta); - host = heap_strdupUtoW(hosta); + host = strdupUtoW(hosta); if(!host) return NS_ERROR_OUT_OF_MEMORY; hres = IUriBuilder_SetHost(This->uri_builder, host); - heap_free(host); + free(host); if(FAILED(hres)) return NS_ERROR_UNEXPECTED; @@ -2790,12 +2790,12 @@ static nsresult NSAPI nsURI_SetPath(nsIFileURL *iface, const nsACString *aPath) return NS_ERROR_UNEXPECTED; nsACString_GetData(aPath, &patha); - path = heap_strdupUtoW(patha); + path = strdupUtoW(patha); if(!path) return NS_ERROR_OUT_OF_MEMORY; hres = IUriBuilder_SetPath(This->uri_builder, path); - heap_free(path); + free(path); if(FAILED(hres)) return NS_ERROR_UNEXPECTED; @@ -2900,12 +2900,12 @@ static nsresult NSAPI nsURI_Resolve(nsIFileURL *iface, const nsACString *aRelati return NS_ERROR_UNEXPECTED; nsACString_GetData(aRelativePath, &patha); - path = heap_strdupUtoW(patha); + path = strdupUtoW(patha); if(!path) return NS_ERROR_OUT_OF_MEMORY; hres = combine_url(This->uri, path, &new_uri); - heap_free(path); + free(path); if(FAILED(hres)) return NS_ERROR_FAILURE; @@ -2914,14 +2914,14 @@ static nsresult NSAPI nsURI_Resolve(nsIFileURL *iface, const nsACString *aRelati if(FAILED(hres)) return NS_ERROR_FAILURE; - reta = heap_strdupWtoU(ret); + reta = strdupWtoU(ret); SysFreeString(ret); if(!reta) return NS_ERROR_OUT_OF_MEMORY; TRACE("returning %s\n", debugstr_a(reta)); nsACString_SetData(_retval, reta); - heap_free(reta); + free(reta); return NS_OK; } @@ -2978,13 +2978,13 @@ static nsresult NSAPI nsURL_GetRef(nsIFileURL *iface, nsACString *aRef) if(FAILED(hres)) return NS_ERROR_UNEXPECTED; - refa = heap_strdupWtoU(ref); + refa = strdupWtoU(ref); SysFreeString(ref); if(ref && !refa) return NS_ERROR_OUT_OF_MEMORY; nsACString_SetData(aRef, refa && *refa == '#' ? refa+1 : refa); - heap_free(refa); + free(refa); return NS_OK; } @@ -3001,12 +3001,12 @@ static nsresult NSAPI nsURL_SetRef(nsIFileURL *iface, const nsACString *aRef) return NS_ERROR_UNEXPECTED; nsACString_GetData(aRef, &refa); - ref = heap_strdupUtoW(refa); + ref = strdupUtoW(refa); if(!ref) return NS_ERROR_OUT_OF_MEMORY; hres = IUriBuilder_SetFragment(This->uri_builder, ref); - heap_free(ref); + free(ref); if(FAILED(hres)) return NS_ERROR_UNEXPECTED; @@ -3154,12 +3154,12 @@ static nsresult NSAPI nsURL_SetQuery(nsIFileURL *iface, const nsACString *aQuery return NS_ERROR_UNEXPECTED; nsACString_GetData(aQuery, &querya); - query = heap_strdupUtoW(querya); + query = strdupUtoW(querya); if(!query) return NS_ERROR_OUT_OF_MEMORY; hres = IUriBuilder_SetQuery(This->uri_builder, query); - heap_free(query); + free(query); if(FAILED(hres)) return NS_ERROR_UNEXPECTED; @@ -3460,7 +3460,7 @@ static nsresult create_nsuri(IUri *iuri, nsWineURI **_retval) nsWineURI *ret; HRESULT hres; - ret = heap_alloc_zero(sizeof(nsWineURI)); + ret = calloc(1, sizeof(nsWineURI)); if(!ret) return NS_ERROR_OUT_OF_MEMORY; @@ -3495,7 +3495,7 @@ static nsresult create_nschannel(nsWineURI *uri, nsChannel **ret) if(!ensure_uri(uri)) return NS_ERROR_UNEXPECTED; - channel = heap_alloc_zero(sizeof(nsChannel)); + channel = calloc(1, sizeof(nsChannel)); if(!channel) return NS_ERROR_OUT_OF_MEMORY; @@ -3626,7 +3626,7 @@ static nsrefcnt NSAPI nsProtocolHandler_Release(nsIProtocolHandler *iface) if(!ref) { if(This->nshandler) nsIProtocolHandler_Release(This->nshandler); - heap_free(This); + free(This); } return ref; @@ -3806,7 +3806,7 @@ static nsresult NSAPI nsIOServiceHook_GetProtocolHandler(nsIIOServiceHook *iface nsIExternalProtocolHandler_Release(nsexthandler); - ret = heap_alloc(sizeof(nsProtocolHandler)); + ret = malloc(sizeof(nsProtocolHandler)); if(!ret) return NS_ERROR_OUT_OF_MEMORY; diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 68cb4491f06..40c36bceb0a 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -446,7 +446,7 @@ static void refresh_destr(task_t *_task) refresh_task_t *task = (refresh_task_t*)_task; IHTMLWindow2_Release(&task->window->base.IHTMLWindow2_iface); - heap_free(task); + free(task); } static HRESULT exec_refresh(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) @@ -478,7 +478,7 @@ static HRESULT exec_refresh(HTMLDocumentNode *doc, DWORD nCmdexecopt, VARIANT *p if(!doc->outer_window) return E_UNEXPECTED; - task = heap_alloc(sizeof(*task)); + task = malloc(sizeof(*task)); if(!task) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index a8bd5751b49..cc2d6aaf5e5 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -88,7 +88,7 @@ static ULONG WINAPI EnumUnknown_Release(IEnumUnknown *iface) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -1895,7 +1895,7 @@ static HRESULT WINAPI DocObjOleContainer_EnumObjects(IOleContainer *iface, DWORD TRACE("(%p)->(%lx %p)\n", This, grfFlags, ppenum); - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -3467,14 +3467,14 @@ static ULONG WINAPI HTMLDocumentObj_Release(IUnknown *iface) if(This->hwnd) DestroyWindow(This->hwnd); - heap_free(This->mime); + free(This->mime); remove_target_tasks(This->task_magic); ConnectionPointContainer_Destroy(&This->cp_container); if(This->nscontainer) detach_gecko_browser(This->nscontainer); - heap_free(This); + free(This); } return ref; @@ -3647,7 +3647,7 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii if(!get_security_manager()) return E_OUTOFMEMORY; - doc = heap_alloc_zero(sizeof(HTMLDocumentObj)); + doc = calloc(1, sizeof(HTMLDocumentObj)); if(!doc) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 5ae20f59ce8..c36673430d0 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -104,7 +104,7 @@ static ULONG WINAPI HTMLDOMImplementation_Release(IHTMLDOMImplementation *iface) if(This->implementation) nsIDOMDOMImplementation_Release(This->implementation); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -320,7 +320,7 @@ HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementa if(!doc_node->browser) return E_UNEXPECTED; - dom_implementation = heap_alloc_zero(sizeof(*dom_implementation)); + dom_implementation = calloc(1, sizeof(*dom_implementation)); if(!dom_implementation) return E_OUTOFMEMORY; @@ -402,7 +402,7 @@ static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface) if(!ref) { release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -568,7 +568,7 @@ HRESULT create_html_screen(compat_mode_t compat_mode, IHTMLScreen **ret) { HTMLScreen *screen; - screen = heap_alloc_zero(sizeof(HTMLScreen)); + screen = calloc(1, sizeof(HTMLScreen)); if(!screen) return E_OUTOFMEMORY; @@ -627,7 +627,7 @@ static ULONG WINAPI OmHistory_Release(IOmHistory *iface) if(!ref) { release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -733,7 +733,7 @@ HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret) { OmHistory *history; - history = heap_alloc_zero(sizeof(*history)); + history = calloc(1, sizeof(*history)); if(!history) return E_OUTOFMEMORY; @@ -805,7 +805,7 @@ static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface) if(This->navigator) This->navigator->plugins = NULL; release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -889,7 +889,7 @@ static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsColl { HTMLPluginsCollection *col; - col = heap_alloc_zero(sizeof(*col)); + col = calloc(1, sizeof(*col)); if(!col) return E_OUTOFMEMORY; @@ -961,7 +961,7 @@ static ULONG WINAPI HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection *if if(This->navigator) This->navigator->mime_types = NULL; release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -1034,7 +1034,7 @@ static HRESULT create_mime_types_collection(OmNavigator *navigator, HTMLMimeType { HTMLMimeTypesCollection *col; - col = heap_alloc_zero(sizeof(*col)); + col = calloc(1, sizeof(*col)); if(!col) return E_OUTOFMEMORY; @@ -1099,7 +1099,7 @@ static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface) if(This->mime_types) This->mime_types->navigator = NULL; release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -1484,7 +1484,7 @@ HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator) { OmNavigator *ret; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -1544,7 +1544,7 @@ static ULONG WINAPI HTMLPerformanceTiming_Release(IHTMLPerformanceTiming *iface) if(!ref) { if(This->dispex.outer) release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -1884,7 +1884,7 @@ HRESULT create_performance_timing(HTMLPerformanceTiming **ret) { HTMLPerformanceTiming *timing; - timing = heap_alloc_zero(sizeof(*timing)); + timing = calloc(1, sizeof(*timing)); if(!timing) return E_OUTOFMEMORY; @@ -1949,7 +1949,7 @@ static ULONG WINAPI HTMLPerformanceNavigation_Release(IHTMLPerformanceNavigation if(!ref) { release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -2107,7 +2107,7 @@ static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface) if(This->navigation) IHTMLPerformanceNavigation_Release(This->navigation); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -2158,7 +2158,7 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface, if(!This->navigation) { HTMLPerformanceNavigation *navigation; - navigation = heap_alloc_zero(sizeof(*navigation)); + navigation = calloc(1, sizeof(*navigation)); if(!navigation) return E_OUTOFMEMORY; @@ -2230,7 +2230,7 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) compat_mode_t compat_mode = dispex_compat_mode(&window->event_target.dispex); HTMLPerformance *performance; - performance = heap_alloc_zero(sizeof(*performance)); + performance = calloc(1, sizeof(*performance)); if(!performance) return E_OUTOFMEMORY; @@ -2303,7 +2303,7 @@ static ULONG WINAPI HTMLNamespaceCollection_Release(IHTMLNamespaceCollection *if if(!ref) { release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -2395,7 +2395,7 @@ HRESULT create_namespace_collection(compat_mode_t compat_mode, IHTMLNamespaceCol { HTMLNamespaceCollection *namespaces; - if (!(namespaces = heap_alloc_zero(sizeof(*namespaces)))) + if (!(namespaces = calloc(1, sizeof(*namespaces)))) return E_OUTOFMEMORY; namespaces->IHTMLNamespaceCollection_iface.lpVtbl = &HTMLNamespaceCollectionVtbl; @@ -2458,7 +2458,7 @@ static ULONG WINAPI console_Release(IWineMSHTMLConsole *iface) if(!ref) { release_dispex(&console->dispex); - heap_free(console); + free(console); } return ref; @@ -2651,7 +2651,7 @@ void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret) { struct console *obj; - obj = heap_alloc_zero(sizeof(*obj)); + obj = calloc(1, sizeof(*obj)); if(!obj) { ERR("No memory.\n"); @@ -2716,7 +2716,7 @@ static ULONG WINAPI media_query_list_Release(IWineMSHTMLMediaQueryList *iface) if(!ref) { nsIDOMMediaQueryList_Release(media_query_list->nsquerylist); release_dispex(&media_query_list->dispex); - heap_free(media_query_list); + free(media_query_list); } return ref; @@ -2837,14 +2837,14 @@ HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch if(!media_query || !media_query[0]) return E_INVALIDARG; - if(!(media_query_list = heap_alloc(sizeof(*media_query_list)))) + if(!(media_query_list = malloc(sizeof(*media_query_list)))) return E_OUTOFMEMORY; nsAString_InitDepend(&nsstr, media_query); nsres = nsIDOMWindow_MatchMedia(window->outer_window->nswindow, &nsstr, &nsunk); nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { - heap_free(media_query_list); + free(media_query_list); return map_nsresult(nsres); } nsres = nsISupports_QueryInterface(nsunk, &IID_nsIDOMMediaQueryList, (void**)&media_query_list->nsquerylist); diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 262633deb9f..d586c25e18a 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -275,7 +275,7 @@ static void set_downloading_task_destr(task_t *_task) download_proc_task_t *task = (download_proc_task_t*)_task; CoTaskMemFree(task->url); - heap_free(task); + free(task); } void prepare_for_binding(HTMLDocumentObj *This, IMoniker *mon, DWORD flags) @@ -404,7 +404,7 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind if(doc_obj->frame) { docobj_task_t *task; - task = heap_alloc(sizeof(docobj_task_t)); + task = malloc(sizeof(docobj_task_t)); task->doc = doc_obj; hres = push_task(&task->header, set_progress_proc, NULL, doc_obj->task_magic); if(FAILED(hres)) { @@ -413,7 +413,7 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind } } - download_task = heap_alloc(sizeof(download_proc_task_t)); + download_task = malloc(sizeof(download_proc_task_t)); download_task->doc = doc_obj; download_task->set_download = set_download; download_task->url = url; @@ -479,7 +479,7 @@ void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate) if(window->readystate_pending || prev_state == readystate) return; - task = heap_alloc(sizeof(*task)); + task = malloc(sizeof(*task)); if(!task) return; @@ -525,7 +525,7 @@ static HRESULT get_doc_string(HTMLDocumentNode *This, char **str) nsAString_GetData(&nsstr, &strw); TRACE("%s\n", debugstr_w(strw)); - *str = heap_strdupWtoA(strw); + *str = strdupWtoA(strw); nsAString_Finish(&nsstr); @@ -827,8 +827,8 @@ static HRESULT WINAPI DocObjMonikerProp_PutProperty(IMonikerProp *iface, MONIKER switch(mkp) { case MIMETYPEPROP: - heap_free(This->mime); - This->mime = heap_strdupW(val); + free(This->mime); + This->mime = wcsdup(val); break; case CLASSIDPROP: @@ -1098,7 +1098,7 @@ static HRESULT WINAPI DocNodePersistStreamInit_Save(IPersistStreamInit *iface, I if(FAILED(hres)) FIXME("Write failed: %08lx\n", hres); - heap_free(str); + free(str); if(fClearDirty) set_dirty(This->doc_obj->nscontainer, VARIANT_FALSE); @@ -1382,7 +1382,7 @@ static HRESULT WINAPI DocObjPersistHistory_LoadHistory(IPersistHistory *iface, I if(read != sizeof(str_len)) return E_FAIL; - uri_str = heap_alloc((str_len+1)*sizeof(WCHAR)); + uri_str = malloc((str_len + 1) * sizeof(WCHAR)); if(!uri_str) return E_OUTOFMEMORY; @@ -1393,7 +1393,7 @@ static HRESULT WINAPI DocObjPersistHistory_LoadHistory(IPersistHistory *iface, I uri_str[str_len] = 0; hres = create_uri(uri_str, 0, &uri); } - heap_free(uri_str); + free(uri_str); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index 4c64c394b6d..4ee5c37de19 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -53,9 +53,9 @@ static void free_prop(param_prop_t *prop) { list_remove(&prop->entry); - heap_free(prop->name); - heap_free(prop->value); - heap_free(prop); + free(prop->name); + free(prop->value); + free(prop); } static param_prop_t *find_prop(PropertyBag *prop_bag, const WCHAR *name) @@ -79,12 +79,12 @@ static HRESULT add_prop(PropertyBag *prop_bag, const WCHAR *name, const WCHAR *v TRACE("%p %s %s\n", prop_bag, debugstr_w(name), debugstr_w(value)); - prop = heap_alloc(sizeof(*prop)); + prop = malloc(sizeof(*prop)); if(!prop) return E_OUTOFMEMORY; - prop->name = heap_strdupW(name); - prop->value = heap_strdupW(value); + prop->name = wcsdup(name); + prop->value = wcsdup(value); if(!prop->name || !prop->value) { list_init(&prop->entry); free_prop(prop); @@ -143,7 +143,7 @@ static ULONG WINAPI PropertyBag_Release(IPropertyBag *iface) if(!ref) { while(!list_empty(&This->props)) free_prop(LIST_ENTRY(This->props.next, param_prop_t, entry)); - heap_free(This); + free(This); } return ref; @@ -331,7 +331,7 @@ static HRESULT create_param_prop_bag(nsIDOMElement *nselem, IPropertyBag **ret) PropertyBag *prop_bag; HRESULT hres; - prop_bag = heap_alloc(sizeof(*prop_bag)); + prop_bag = malloc(sizeof(*prop_bag)); if(!prop_bag) return E_OUTOFMEMORY; @@ -734,14 +734,14 @@ HRESULT get_plugin_dispid(HTMLPluginContainer *plugin_container, WCHAR *name, DI } if(!plugin_container->props) { - plugin_container->props = heap_alloc(8*sizeof(DISPID)); + plugin_container->props = malloc(8 * sizeof(DISPID)); if(!plugin_container->props) return E_OUTOFMEMORY; plugin_container->props_size = 8; }else if(plugin_container->props_len == plugin_container->props_size) { DISPID *new_props; - new_props = heap_realloc(plugin_container->props, plugin_container->props_size*2*sizeof(DISPID)); + new_props = realloc(plugin_container->props, plugin_container->props_size * 2 * sizeof(DISPID)); if(!new_props) return E_OUTOFMEMORY; @@ -822,14 +822,14 @@ static void add_sink_handler(PHEventSink *sink, DISPID id, IDispatch *disp) IDispatch_Release(entry->disp); }else { if(!sink->handlers_size) { - sink->handlers = heap_alloc(4*sizeof(*sink->handlers)); + sink->handlers = malloc(4 * sizeof(*sink->handlers)); if(!sink->handlers) return; sink->handlers_size = 4; }else if(sink->handlers_cnt == sink->handlers_size) { sink_entry_t *new_handlers; - new_handlers = heap_realloc(sink->handlers, 2*sink->handlers_size*sizeof(*sink->handlers)); + new_handlers = realloc(sink->handlers, 2 * sink->handlers_size * sizeof(*sink->handlers)); if(!new_handlers) return; sink->handlers = new_handlers; @@ -897,8 +897,8 @@ static ULONG WINAPI PHEventSink_Release(IDispatch *iface) if(This->handlers[i].disp) IDispatch_Release(This->handlers[i].disp); } - heap_free(This->handlers); - heap_free(This); + free(This->handlers); + free(This); } return ref; @@ -1015,7 +1015,7 @@ static PHEventSink *create_event_sink(PluginHost *plugin_host, ITypeInfo *typein return NULL; } - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(ret) { ret->IDispatch_iface.lpVtbl = &PHCPDispatchVtbl; ret->ref = 1; @@ -1190,7 +1190,7 @@ static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -1309,7 +1309,7 @@ static HRESULT create_ip_frame(IOleInPlaceFrame **ret) { InPlaceFrame *frame; - frame = heap_alloc_zero(sizeof(*frame)); + frame = calloc(1, sizeof(*frame)); if(!frame) return E_OUTOFMEMORY; @@ -1370,7 +1370,7 @@ static ULONG WINAPI InPlaceUIWindow_Release(IOleInPlaceUIWindow *iface) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -1437,7 +1437,7 @@ static HRESULT create_ip_window(IOleInPlaceUIWindow **ret) { InPlaceUIWindow *uiwindow; - uiwindow = heap_alloc_zero(sizeof(*uiwindow)); + uiwindow = calloc(1, sizeof(*uiwindow)); if(!uiwindow) return E_OUTOFMEMORY; @@ -1553,7 +1553,7 @@ static ULONG WINAPI PHClientSite_Release(IOleClientSite *iface) list_remove(&This->entry); if(This->element) This->element->plugin_host = NULL; - heap_free(This); + free(This); } return ref; @@ -2355,7 +2355,7 @@ static ULONG WINAPI InstallCallback_Release(IBindStatusCallback *iface) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -2499,7 +2499,7 @@ static void install_codebase(const WCHAR *url) IBindCtx *bctx; HRESULT hres; - callback = heap_alloc(sizeof(*callback)); + callback = malloc(sizeof(*callback)); if(!callback) return; @@ -2555,7 +2555,7 @@ static void check_codebase(HTMLInnerWindow *window, nsIDOMElement *nselem) } if(!is_on_list) { - iter = heap_alloc(sizeof(*iter)); + iter = malloc(sizeof(*iter)); if(iter) { IUri_AddRef(uri); iter->uri = uri; @@ -2694,7 +2694,7 @@ HRESULT create_plugin_host(HTMLDocumentNode *doc, HTMLPluginContainer *container if(!unk) return E_FAIL; - host = heap_alloc_zero(sizeof(*host)); + host = calloc(1, sizeof(*host)); if(!host) { IUnknown_Release(unk); return E_OUTOFMEMORY; diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c index cc911c50f41..dd492b32ad6 100644 --- a/dlls/mshtml/protocol.c +++ b/dlls/mshtml/protocol.c @@ -192,8 +192,8 @@ static ULONG WINAPI Protocol_Release(IUnknown *iface) TRACE("(%p) ref=%lx\n", iface, ref); if(!ref) { - heap_free(This->data); - heap_free(This); + free(This->data); + free(This); } return ref; @@ -316,7 +316,7 @@ static HRESULT create_protocol_instance(const IInternetProtocolVtbl *protocol_vt return E_INVALIDARG; } - protocol = heap_alloc_zero(sizeof(InternetProtocol)); + protocol = calloc(1, sizeof(InternetProtocol)); protocol->IUnknown_inner.lpVtbl = &ProtocolUnkVtbl; protocol->IInternetProtocol_iface.lpVtbl = protocol_vtbl; protocol->outer = outer ? outer : &protocol->IUnknown_inner; @@ -371,11 +371,11 @@ static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUr data_len = sizeof(L"\xfeff")+sizeof(L"")-sizeof(WCHAR) + (text ? lstrlenW(text)*sizeof(WCHAR) : 0); - data = heap_alloc(data_len); + data = malloc(data_len); if(!data) return E_OUTOFMEMORY; - heap_free(This->data); + free(This->data); This->data = data; This->data_len = data_len; @@ -554,11 +554,11 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, ReleaseBindInfo(&bindinfo); len = lstrlenW(szUrl)+16; - url = heap_alloc(len*sizeof(WCHAR)); + url = malloc(len * sizeof(WCHAR)); hres = CoInternetParseUrl(szUrl, PARSE_ENCODE, 0, url, len, &len, 0); if(FAILED(hres)) { WARN("CoInternetParseUrl failed: %08lx\n", hres); - heap_free(url); + free(url); IInternetProtocolSink_ReportResult(pOIProtSink, hres, 0, NULL); return hres; } @@ -566,7 +566,7 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, if(len < ARRAY_SIZE(wszRes) || memcmp(url, wszRes, sizeof(wszRes))) { WARN("Wrong protocol of url: %s\n", debugstr_w(url)); IInternetProtocolSink_ReportResult(pOIProtSink, E_INVALIDARG, 0, NULL); - heap_free(url); + free(url); return E_INVALIDARG; } @@ -574,7 +574,7 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, if(!(res_type = wcschr(url_dll, '/'))) { WARN("wrong url: %s\n", debugstr_w(url)); IInternetProtocolSink_ReportResult(pOIProtSink, MK_E_SYNTAX, 0, NULL); - heap_free(url); + free(url); return MK_E_SYNTAX; } @@ -602,7 +602,7 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, if(!hdll) { WARN("Could not open dll: %s\n", debugstr_w(url_dll)); IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL); - heap_free(url); + free(url); return HRESULT_FROM_WIN32(GetLastError()); } @@ -623,25 +623,25 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, WARN("Could not find resource\n"); IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL); - heap_free(url); + free(url); return HRESULT_FROM_WIN32(GetLastError()); } } if(This->data) { WARN("data already loaded\n"); - heap_free(This->data); + free(This->data); } This->data_len = SizeofResource(hdll, src); - This->data = heap_alloc(This->data_len); + This->data = malloc(This->data_len); memcpy(This->data, LoadResource(hdll, src), This->data_len); This->cur = 0; FreeLibrary(hdll); hres = FindMimeFromData(NULL, url_file, This->data, This->data_len, NULL, 0, &mime, 0); - heap_free(url); + free(url); if(SUCCEEDED(hres)) { IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, mime); CoTaskMemFree(mime); diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c index 5c93b39f4ab..23a42987841 100644 --- a/dlls/mshtml/range.c +++ b/dlls/mshtml/range.c @@ -351,7 +351,7 @@ static inline BOOL wstrbuf_init(wstrbuf_t *buf) { buf->len = 0; buf->size = 16; - buf->buf = heap_alloc(buf->size * sizeof(WCHAR)); + buf->buf = malloc(buf->size * sizeof(WCHAR)); if (!buf->buf) return FALSE; *buf->buf = 0; return TRUE; @@ -359,14 +359,14 @@ static inline BOOL wstrbuf_init(wstrbuf_t *buf) static inline void wstrbuf_finish(wstrbuf_t *buf) { - heap_free(buf->buf); + free(buf->buf); } static void wstrbuf_append_len(wstrbuf_t *buf, LPCWSTR str, int len) { if(buf->len+len >= buf->size) { buf->size = 2*buf->size+len; - buf->buf = heap_realloc(buf->buf, buf->size * sizeof(WCHAR)); + buf->buf = realloc(buf->buf, buf->size * sizeof(WCHAR)); } memcpy(buf->buf+buf->len, str, len*sizeof(WCHAR)); @@ -383,7 +383,7 @@ static void wstrbuf_append_nodetxt(wstrbuf_t *buf, LPCWSTR str, int len) if(buf->len+len >= buf->size) { buf->size = 2*buf->size+len; - buf->buf = heap_realloc(buf->buf, buf->size * sizeof(WCHAR)); + buf->buf = realloc(buf->buf, buf->size * sizeof(WCHAR)); } if(buf->len && iswspace(buf->buf[buf->len-1])) { @@ -859,7 +859,7 @@ static ULONG WINAPI HTMLTxtRange_Release(IHTMLTxtRange *iface) if(This->doc) list_remove(&This->entry); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -1730,7 +1730,7 @@ HRESULT HTMLTxtRange_Create(HTMLDocumentNode *doc, nsIDOMRange *nsrange, IHTMLTx { HTMLTxtRange *ret; - ret = heap_alloc(sizeof(HTMLTxtRange)); + ret = malloc(sizeof(HTMLTxtRange)); if(!ret) return E_OUTOFMEMORY; @@ -1800,7 +1800,7 @@ static ULONG WINAPI HTMLDOMRange_Release(IHTMLDOMRange *iface) if(This->nsrange) nsIDOMRange_Release(This->nsrange); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -2076,7 +2076,7 @@ HRESULT create_dom_range(nsIDOMRange *nsrange, compat_mode_t compat_mode, IHTMLD { HTMLDOMRange *ret; - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; @@ -2153,7 +2153,7 @@ static ULONG WINAPI MarkupPointer2_Release(IMarkupPointer2 *iface) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -2387,7 +2387,7 @@ HRESULT create_markup_pointer(IMarkupPointer **ret) { MarkupPointer *markup_pointer; - if(!(markup_pointer = heap_alloc(sizeof(*markup_pointer)))) + if(!(markup_pointer = malloc(sizeof(*markup_pointer)))) return E_OUTOFMEMORY; markup_pointer->IMarkupPointer2_iface.lpVtbl = &MarkupPointer2Vtbl; diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index 11f289aa2d3..5321080a8f9 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -324,7 +324,7 @@ static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface) release_script_engine(This); if(This->window) list_remove(&This->entry); - heap_free(This); + free(This); } return ref; @@ -693,7 +693,7 @@ static ScriptHost *create_script_host(HTMLInnerWindow *window, const GUID *guid) ScriptHost *ret; HRESULT hres; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) return NULL; @@ -782,7 +782,7 @@ static void set_script_elem_readystate(HTMLScriptElement *script_elem, READYSTAT if(script_elem->pending_readystatechange_event) return; - task = heap_alloc(sizeof(*task)); + task = malloc(sizeof(*task)); if(!task) return; @@ -838,7 +838,7 @@ static HRESULT get_binding_text(ScriptBSC *bsc, WCHAR **ret) WCHAR *text; if(!bsc->bsc.read) { - text = heap_alloc(sizeof(WCHAR)); + text = malloc(sizeof(WCHAR)); if(!text) return E_OUTOFMEMORY; *text = 0; @@ -853,7 +853,7 @@ static HRESULT get_binding_text(ScriptBSC *bsc, WCHAR **ret) return E_FAIL; } - text = heap_alloc(bsc->bsc.read+sizeof(WCHAR)); + text = malloc(bsc->bsc.read + sizeof(WCHAR)); if(!text) return E_OUTOFMEMORY; @@ -869,7 +869,7 @@ static HRESULT get_binding_text(ScriptBSC *bsc, WCHAR **ret) DWORD len; len = MultiByteToWideChar(cp, 0, bsc->buf, bsc->bsc.read, NULL, 0); - text = heap_alloc((len+1)*sizeof(WCHAR)); + text = malloc((len + 1) * sizeof(WCHAR)); if(!text) return E_OUTOFMEMORY; @@ -906,7 +906,7 @@ static void script_file_available(ScriptBSC *bsc) TRACE("Adding to queue\n"); - queue = heap_alloc(sizeof(*queue)); + queue = malloc(sizeof(*queue)); if(!queue) return; @@ -956,8 +956,8 @@ static void ScriptBSC_destroy(BSCallback *bsc) if(This->load_group) nsILoadGroup_Release(This->load_group); - heap_free(This->buf); - heap_free(This); + free(This->buf); + free(This); } static HRESULT ScriptBSC_init_bindinfo(BSCallback *bsc) @@ -1006,7 +1006,7 @@ static HRESULT ScriptBSC_stop_binding(BSCallback *bsc, HRESULT result) script_file_available(This); }else { FIXME("binding failed %08lx\n", result); - heap_free(This->buf); + free(This->buf); This->buf = NULL; This->size = 0; } @@ -1031,7 +1031,7 @@ static HRESULT ScriptBSC_read_data(BSCallback *bsc, IStream *stream) HRESULT hres; if(!This->buf) { - This->buf = heap_alloc(128); + This->buf = malloc(128); if(!This->buf) return E_OUTOFMEMORY; This->size = 128; @@ -1040,7 +1040,7 @@ static HRESULT ScriptBSC_read_data(BSCallback *bsc, IStream *stream) do { if(This->bsc.read >= This->size) { void *new_buf; - new_buf = heap_realloc(This->buf, This->size << 1); + new_buf = realloc(This->buf, This->size << 1); if(!new_buf) return E_OUTOFMEMORY; This->size <<= 1; @@ -1111,7 +1111,7 @@ HRESULT load_script(HTMLScriptElement *script_elem, const WCHAR *src, BOOL async return hres; } - bsc = heap_alloc_zero(sizeof(*bsc)); + bsc = calloc(1, sizeof(*bsc)); if(!bsc) { IMoniker_Release(mon); IUri_Release(uri); @@ -1359,7 +1359,7 @@ IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text) LPWSTR language; BOOL b; - language = heap_alloc((ptr-text+1)*sizeof(WCHAR)); + language = malloc((ptr - text + 1) * sizeof(WCHAR)); if(!language) return NULL; @@ -1368,7 +1368,7 @@ IDispatch *script_parse_event(HTMLInnerWindow *window, LPCWSTR text) b = get_guid_from_language(language, &guid); - heap_free(language); + free(language); if(!b) { WARN("Could not find language\n"); @@ -1542,7 +1542,7 @@ static IDispatch *parse_event_elem(HTMLDocumentNode *doc, HTMLScriptElement *scr const PRUnichar *event_val; nsAString_GetData(&nsstr, &event_val); - event = heap_strdupW(event_val); + event = wcsdup(event_val); } nsAString_Finish(&nsstr); if(!event) @@ -1550,7 +1550,7 @@ static IDispatch *parse_event_elem(HTMLDocumentNode *doc, HTMLScriptElement *scr if(!parse_event_str(event, &args)) { WARN("parsing %s failed\n", debugstr_w(event)); - heap_free(event); + free(event); return NULL; } @@ -1571,7 +1571,7 @@ static IDispatch *parse_event_elem(HTMLDocumentNode *doc, HTMLScriptElement *scr } nsAString_Finish(&nsstr); if(!disp) { - heap_free(event); + free(event); return NULL; } @@ -1644,7 +1644,7 @@ void bind_event_scripts(HTMLDocumentNode *doc) node_release(&plugin_container->element.node); } - heap_free(event); + free(event); IDispatch_Release(event_disp); } @@ -1765,7 +1765,7 @@ void release_script_hosts(HTMLInnerWindow *window) list_remove(&queue_iter->entry); IHTMLScriptElement_Release(&queue_iter->script->IHTMLScriptElement_iface); - heap_free(queue_iter); + free(queue_iter); } while(!list_empty(&window->script_hosts)) { diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index 052dc2fcfe6..03a330d3f30 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -99,7 +99,7 @@ static ULONG WINAPI HTMLSelectionObject_Release(IHTMLSelectionObject *iface) if(This->doc) list_remove(&This->entry); release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -345,7 +345,7 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect { HTMLSelectionObject *selection; - selection = heap_alloc(sizeof(HTMLSelectionObject)); + selection = malloc(sizeof(HTMLSelectionObject)); if(!selection) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/service.c b/dlls/mshtml/service.c index 6b162e235ec..1f440b846e8 100644 --- a/dlls/mshtml/service.c +++ b/dlls/mshtml/service.c @@ -81,7 +81,7 @@ static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -193,7 +193,7 @@ static const IOleUndoManagerVtbl OleUndoManagerVtbl = { static IOleUndoManager *create_undomgr(void) { - UndoManager *ret = heap_alloc(sizeof(UndoManager)); + UndoManager *ret = malloc(sizeof(UndoManager)); if (!ret) return NULL; @@ -250,7 +250,7 @@ static ULONG WINAPI editsvcs_Release(IHTMLEditServices *iface) TRACE("(%p) ref=%ld\n", This, ref); if(!ref) - heap_free(This); + free(This); return ref; } @@ -317,7 +317,7 @@ static const IHTMLEditServicesVtbl editsvcsVtbl = { static IHTMLEditServices *create_editsvcs(void) { - editsvcs *ret = heap_alloc(sizeof(*ret)); + editsvcs *ret = malloc(sizeof(*ret)); if (ret) { ret->IHTMLEditServices_iface.lpVtbl = &editsvcsVtbl; diff --git a/dlls/mshtml/svg.c b/dlls/mshtml/svg.c index bd52bd70108..b03ad073244 100644 --- a/dlls/mshtml/svg.c +++ b/dlls/mshtml/svg.c @@ -747,7 +747,7 @@ static HRESULT create_viewport_element(HTMLDocumentNode *doc, nsIDOMSVGElement * { SVGSVGElement *ret; - ret = heap_alloc_zero(sizeof(SVGSVGElement)); + ret = calloc(1, sizeof(SVGSVGElement)); if(!ret) return E_OUTOFMEMORY; @@ -916,7 +916,7 @@ static HRESULT create_circle_element(HTMLDocumentNode *doc, nsIDOMSVGElement *ns { SVGCircleElement *ret; - ret = heap_alloc_zero(sizeof(SVGCircleElement)); + ret = calloc(1, sizeof(SVGCircleElement)); if(!ret) return E_OUTOFMEMORY; @@ -1160,7 +1160,7 @@ static HRESULT create_tspan_element(HTMLDocumentNode *doc, nsIDOMSVGElement *nse { SVGTSpanElement *ret; - ret = heap_alloc_zero(sizeof(SVGTSpanElement)); + ret = calloc(1, sizeof(SVGTSpanElement)); if(!ret) return E_OUTOFMEMORY; @@ -1185,7 +1185,7 @@ HRESULT create_svg_element(HTMLDocumentNode *doc, nsIDOMSVGElement *dom_element, if(!wcscmp(tag_name, L"tspan")) return create_tspan_element(doc, dom_element, elem); - svg_element = heap_alloc_zero(sizeof(*svg_element)); + svg_element = calloc(1, sizeof(*svg_element)); if(!svg_element) return E_OUTOFMEMORY; diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c index 28564f7b8d8..2987b4bf19d 100644 --- a/dlls/mshtml/task.c +++ b/dlls/mshtml/task.c @@ -48,7 +48,7 @@ typedef struct { static void default_task_destr(task_t *task) { - heap_free(task); + free(task); } HRESULT push_task(task_t *task, task_proc_t proc, task_proc_t destr, LONG magic) @@ -60,7 +60,7 @@ HRESULT push_task(task_t *task, task_proc_t proc, task_proc_t destr, LONG magic) if(destr) destr(task); else - heap_free(task); + free(task); return E_OUTOFMEMORY; } @@ -97,7 +97,7 @@ static void release_task_timer(HWND thread_hwnd, task_timer_t *timer) IDispatch_Release(timer->disp); - heap_free(timer); + free(timer); } void remove_target_tasks(LONG target) @@ -174,7 +174,7 @@ HRESULT set_task_timer(HTMLInnerWindow *window, LONG msec, enum timer_type timer if(!thread_data) return E_OUTOFMEMORY; - timer = heap_alloc(sizeof(task_timer_t)); + timer = malloc(sizeof(task_timer_t)); if(!timer) return E_OUTOFMEMORY; @@ -409,7 +409,7 @@ thread_data_t *get_thread_data(BOOL create) thread_data = TlsGetValue(mshtml_tls); if(!thread_data && create) { - thread_data = heap_alloc_zero(sizeof(thread_data_t)); + thread_data = calloc(1, sizeof(thread_data_t)); if(!thread_data) return NULL; diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index eaf3a822c2b..deaf7d38be9 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -354,7 +354,7 @@ static LRESULT WINAPI tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l static void create_tooltips_window(HTMLDocumentObj *This) { - tooltip_data *data = heap_alloc(sizeof(*data)); + tooltip_data *data = malloc(sizeof(*data)); This->tooltips_hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, TTS_NOPREFIX | WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, This->hwnd, NULL, hInst, NULL); diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c index e01c9791f6f..b4269bbe8d1 100644 --- a/dlls/mshtml/xmlhttprequest.c +++ b/dlls/mshtml/xmlhttprequest.c @@ -38,11 +38,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); static HRESULT bstr_to_nsacstr(BSTR bstr, nsACString *str) { - char *cstr = heap_strdupWtoU(bstr); + char *cstr = strdupWtoU(bstr); if(!cstr) return E_OUTOFMEMORY; nsACString_Init(str, cstr); - heap_free(cstr); + free(cstr); return S_OK; } @@ -215,7 +215,7 @@ static nsrefcnt NSAPI XMLHttpReqEventListener_Release(nsIDOMEventListener *iface if(!ref) { assert(!This->xhr); - heap_free(This); + free(This); } return ref; @@ -303,7 +303,7 @@ static ULONG WINAPI HTMLXMLHttpRequest_Release(IHTMLXMLHttpRequest *iface) release_event_target(&This->event_target); release_dispex(&This->event_target.dispex); nsIXMLHttpRequest_Release(This->nsxhr); - heap_free(This); + free(This); } return ref; @@ -703,14 +703,14 @@ static HRESULT WINAPI HTMLXMLHttpRequest_getResponseHeader(IHTMLXMLHttpRequest * return E_FAIL; } - cstr = heap_strdupWtoU(bstrHeader); + cstr = strdupWtoU(bstrHeader); nsACString_InitDepend(&header, cstr); nsACString_Init(&ret, NULL); nsres = nsIXMLHttpRequest_GetResponseHeader(This->nsxhr, &header, &ret); nsACString_Finish(&header); - heap_free(cstr); + free(cstr); return return_nscstr(nsres, &ret, p); } @@ -723,13 +723,13 @@ static HRESULT WINAPI HTMLXMLHttpRequest_setRequestHeader(IHTMLXMLHttpRequest *i TRACE("(%p)->(%s %s)\n", This, debugstr_w(bstrHeader), debugstr_w(bstrValue)); - header_u = heap_strdupWtoU(bstrHeader); + header_u = strdupWtoU(bstrHeader); if(bstrHeader && !header_u) return E_OUTOFMEMORY; - value_u = heap_strdupWtoU(bstrValue); + value_u = strdupWtoU(bstrValue); if(bstrValue && !value_u) { - heap_free(header_u); + free(header_u); return E_OUTOFMEMORY; } @@ -738,8 +738,8 @@ static HRESULT WINAPI HTMLXMLHttpRequest_setRequestHeader(IHTMLXMLHttpRequest *i nsres = nsIXMLHttpRequest_SetRequestHeader(This->nsxhr, &header, &value); nsACString_Finish(&header); nsACString_Finish(&value); - heap_free(header_u); - heap_free(value_u); + free(header_u); + free(value_u); if(NS_FAILED(nsres)) { ERR("SetRequestHeader failed: %08lx\n", nsres); return E_FAIL; @@ -1073,7 +1073,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_overrideMimeType(IWineXMLHttpRe if(mimeType) { if(mimeType[0]) { - if(!(lowercase = heap_strdupW(mimeType))) + if(!(lowercase = wcsdup(mimeType))) return E_OUTOFMEMORY; _wcslwr(lowercase); type = lowercase; @@ -1084,7 +1084,7 @@ static HRESULT WINAPI HTMLXMLHttpRequest_private_overrideMimeType(IWineXMLHttpRe nsAString_InitDepend(&nsstr, type); nsres = nsIXMLHttpRequest_SlowOverrideMimeType(This->nsxhr, &nsstr); nsAString_Finish(&nsstr); - heap_free(lowercase); + free(lowercase); return map_nsresult(nsres); } @@ -1299,7 +1299,7 @@ static void HTMLXMLHttpRequest_bind_event(DispatchEx *dispex, eventid_t eid) return; if(!This->event_listener) { - This->event_listener = heap_alloc(sizeof(*This->event_listener)); + This->event_listener = malloc(sizeof(*This->event_listener)); if(!This->event_listener) return; @@ -1424,7 +1424,7 @@ static ULONG WINAPI HTMLXMLHttpRequestFactory_Release(IHTMLXMLHttpRequestFactory if(!ref) { release_dispex(&This->dispex); - heap_free(This); + free(This); } return ref; @@ -1474,7 +1474,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactor if(!nsxhr) return E_FAIL; - ret = heap_alloc_zero(sizeof(*ret)); + ret = calloc(1, sizeof(*ret)); if(!ret) { nsIXMLHttpRequest_Release(nsxhr); return E_OUTOFMEMORY; @@ -1551,7 +1551,7 @@ HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow* window, HTMLXMLHttpReq { HTMLXMLHttpRequestFactory *ret; - ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY;