Use existing helpers for heap allocations

Nikolay Sivov bunglehead at gmail.com
Wed Feb 3 13:47:53 CST 2010


---
 dlls/msxml3/attribute.c   |    4 +-
 dlls/msxml3/bsc.c         |   10 +++----
 dlls/msxml3/cdata.c       |    8 +++---
 dlls/msxml3/comment.c     |    4 +-
 dlls/msxml3/docfrag.c     |    4 +-
 dlls/msxml3/domdoc.c      |   40 +++++++++++++++---------------
 dlls/msxml3/domimpl.c     |    4 +-
 dlls/msxml3/element.c     |   22 ++++++++--------
 dlls/msxml3/entityref.c   |    4 +-
 dlls/msxml3/httprequest.c |    4 +-
 dlls/msxml3/node.c        |    8 +++---
 dlls/msxml3/nodelist.c    |    4 +-
 dlls/msxml3/nodemap.c     |   10 +++---
 dlls/msxml3/parseerror.c  |    4 +-
 dlls/msxml3/pi.c          |    4 +-
 dlls/msxml3/queryresult.c |    2 +-
 dlls/msxml3/saxreader.c   |   60 +++++++++++++++++++++------------------------
 dlls/msxml3/schema.c      |    4 +-
 dlls/msxml3/text.c        |    8 +++---
 dlls/msxml3/xmldoc.c      |    4 +-
 dlls/msxml3/xmlelem.c     |   18 ++++++------
 21 files changed, 112 insertions(+), 118 deletions(-)

diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c
index 6df849e..04b8c46 100644
--- a/dlls/msxml3/attribute.c
+++ b/dlls/msxml3/attribute.c
@@ -94,7 +94,7 @@ static ULONG WINAPI domattr_Release(
     if ( ref == 0 )
     {
         destroy_xmlnode(&This->node);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -546,7 +546,7 @@ IUnknown* create_attribute( xmlNodePtr attribute )
 {
     domattr *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/bsc.c b/dlls/msxml3/bsc.c
index 1914ca8..b24e04c 100644
--- a/dlls/msxml3/bsc.c
+++ b/dlls/msxml3/bsc.c
@@ -93,11 +93,9 @@ static ULONG WINAPI bsc_Release(
     TRACE("(%p) ref=%d\n", This, ref);
 
     if(!ref) {
-        if(This->binding)
-            IBinding_Release(This->binding);
-        if(This->memstream)
-            IStream_Release(This->memstream);
-        HeapFree(GetProcessHeap(), 0, This);
+        if (This->binding)   IBinding_Release(This->binding);
+        if (This->memstream) IStream_Release(This->memstream);
+        heap_free(This);
     }
 
     return ref;
@@ -270,7 +268,7 @@ HRESULT bind_url(LPCWSTR url, HRESULT (*onDataAvailable)(void*,char*,DWORD), voi
     if(FAILED(hr))
         return hr;
 
-    bsc = HeapAlloc(GetProcessHeap(), 0, sizeof(bsc_t));
+    bsc = heap_alloc(sizeof(bsc_t));
 
     bsc->lpVtbl = &bsc_vtbl;
     bsc->ref = 1;
diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c
index 8bc1329..7d02a94 100644
--- a/dlls/msxml3/cdata.c
+++ b/dlls/msxml3/cdata.c
@@ -101,7 +101,7 @@ static ULONG WINAPI domcdata_Release(
     if ( ref == 0 )
     {
         destroy_xmlnode(&This->node);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -606,7 +606,7 @@ static HRESULT WINAPI domcdata_appendData(
     }
     else
         hr = E_FAIL;
-    HeapFree(GetProcessHeap(), 0, pContent);
+    heap_free(pContent);
 
     return hr;
 }
@@ -667,7 +667,7 @@ static HRESULT WINAPI domcdata_insertData(
                 xmlNodeSetContent(This->node.node, str);
                 hr = S_OK;
             }
-            HeapFree(GetProcessHeap(), 0, str);
+            heap_free(str);
 
             SysFreeString(sNewString);
         }
@@ -804,7 +804,7 @@ IUnknown* create_cdata( xmlNodePtr text )
 {
     domcdata *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index 62132a7..1e3b965 100644
--- a/dlls/msxml3/comment.c
+++ b/dlls/msxml3/comment.c
@@ -95,7 +95,7 @@ static ULONG WINAPI domcomment_Release(
     if ( ref == 0 )
     {
         destroy_xmlnode(&This->node);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -802,7 +802,7 @@ IUnknown* create_comment( xmlNodePtr comment )
 {
     domcomment *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c
index f5ac1aa..b5f6e46 100644
--- a/dlls/msxml3/docfrag.c
+++ b/dlls/msxml3/docfrag.c
@@ -94,7 +94,7 @@ static ULONG WINAPI domfrag_Release(
     if ( ref == 0 )
     {
         destroy_xmlnode(&This->node);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -519,7 +519,7 @@ IUnknown* create_doc_fragment( xmlNodePtr fragment )
 {
     domfrag *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index e75537f..4914a7c 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -119,7 +119,7 @@ static inline xmldoc_priv * priv_from_xmlDocPtr(xmlDocPtr doc)
 static xmldoc_priv * create_priv(void)
 {
     xmldoc_priv *priv;
-    priv = HeapAlloc( GetProcessHeap(), 0, sizeof (*priv) );
+    priv = heap_alloc( sizeof (*priv) );
 
     if(priv)
     {
@@ -164,9 +164,9 @@ LONG xmldoc_release(xmlDocPtr doc)
         LIST_FOR_EACH_ENTRY_SAFE( orphan, orphan2, &priv->orphans, orphan_entry, entry )
         {
             xmlFreeNode( orphan->node );
-            HeapFree( GetProcessHeap(), 0, orphan );
+            heap_free( orphan );
         }
-        HeapFree(GetProcessHeap(), 0, doc->_private);
+        heap_free(doc->_private);
 
         xmlFreeDoc(doc);
     }
@@ -179,7 +179,7 @@ HRESULT xmldoc_add_orphan(xmlDocPtr doc, xmlNodePtr node)
     xmldoc_priv *priv = priv_from_xmlDocPtr(doc);
     orphan_entry *entry;
 
-    entry = HeapAlloc( GetProcessHeap(), 0, sizeof (*entry) );
+    entry = heap_alloc( sizeof (*entry) );
     if(!entry)
         return E_OUTOFMEMORY;
 
@@ -198,7 +198,7 @@ HRESULT xmldoc_remove_orphan(xmlDocPtr doc, xmlNodePtr node)
         if( entry->node == node )
         {
             list_remove( &entry->entry );
-            HeapFree( GetProcessHeap(), 0, entry );
+            heap_free( entry );
             return S_OK;
         }
     }
@@ -1041,7 +1041,7 @@ static HRESULT WINAPI domdoc_createElement(
 
     TRACE("created xmlptr %p\n", xmlnode);
     elem_unk = create_element(xmlnode);
-    HeapFree(GetProcessHeap(), 0, xml_name);
+    heap_free(xml_name);
 
     hr = IUnknown_QueryInterface(elem_unk, &IID_IXMLDOMElement, (void **)element);
     IUnknown_Release(elem_unk);
@@ -1094,7 +1094,7 @@ static HRESULT WINAPI domdoc_createTextNode(
 
     xml_content = xmlChar_from_wchar(data);
     xmlnode = xmlNewText(xml_content);
-    HeapFree(GetProcessHeap(), 0, xml_content);
+    heap_free(xml_content);
 
     if(!xmlnode)
         return E_FAIL;
@@ -1126,7 +1126,7 @@ static HRESULT WINAPI domdoc_createComment(
 
     xml_content = xmlChar_from_wchar(data);
     xmlnode = xmlNewComment(xml_content);
-    HeapFree(GetProcessHeap(), 0, xml_content);
+    heap_free(xml_content);
 
     if(!xmlnode)
         return E_FAIL;
@@ -1158,7 +1158,7 @@ static HRESULT WINAPI domdoc_createCDATASection(
 
     xml_content = xmlChar_from_wchar(data);
     xmlnode = xmlNewCDataBlock(get_doc( This ), xml_content, strlen( (char*)xml_content) );
-    HeapFree(GetProcessHeap(), 0, xml_content);
+    heap_free(xml_content);
 
     if(!xmlnode)
         return E_FAIL;
@@ -1199,8 +1199,8 @@ static HRESULT WINAPI domdoc_createProcessingInstruction(
     TRACE("created xmlptr %p\n", xmlnode);
     *pi = (IXMLDOMProcessingInstruction*)create_pi(xmlnode);
 
-    HeapFree(GetProcessHeap(), 0, xml_content);
-    HeapFree(GetProcessHeap(), 0, xml_target);
+    heap_free(xml_content);
+    heap_free(xml_target);
 
     return S_OK;
 #else
@@ -1228,7 +1228,7 @@ static HRESULT WINAPI domdoc_createAttribute(
 
     xml_name = xmlChar_from_wchar(name);
     xmlnode = (xmlNode *)xmlNewProp(NULL, xml_name, NULL);
-    HeapFree(GetProcessHeap(), 0, xml_name);
+    heap_free(xml_name);
 
     if(!xmlnode)
         return E_FAIL;
@@ -1260,7 +1260,7 @@ static HRESULT WINAPI domdoc_createEntityReference(
 
     xml_name = xmlChar_from_wchar(name);
     xmlnode = xmlNewReference(get_doc( This ), xml_name );
-    HeapFree(GetProcessHeap(), 0, xml_name);
+    heap_free(xml_name);
 
     if(!xmlnode)
         return E_FAIL;
@@ -1288,19 +1288,19 @@ static HRESULT WINAPI domdoc_getElementsByTagName(
 
     if (tagName[0] == '*' && tagName[1] == 0)
     {
-        szPattern = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*4);
+        szPattern = heap_alloc(sizeof(WCHAR)*4);
         szPattern[0] = szPattern[1] = '/';
         szPattern[2] = '*';
         szPattern[3] = 0;
     }
     else
     {
-        szPattern = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(20+lstrlenW(tagName)+1));
+        szPattern = heap_alloc(sizeof(WCHAR)*(20+lstrlenW(tagName)+1));
         wsprintfW(szPattern, xpathformat, tagName);
     }
 
     hr = queryresult_create((xmlNodePtr)get_doc(This), szPattern, resultList);
-    HeapFree(GetProcessHeap(), 0, szPattern);
+    heap_free(szPattern);
 
     return hr;
 }
@@ -1370,7 +1370,7 @@ static HRESULT WINAPI domdoc_createNode(
         break;
     }
 
-    HeapFree(GetProcessHeap(), 0, xml_name);
+    heap_free(xml_name);
 
     if(xmlnode && *node)
     {
@@ -1599,7 +1599,7 @@ static BOOL bstr_to_utf8( BSTR bstr, char **pstr, int *plen )
     LPSTR str;
 
     len = WideCharToMultiByte( CP_UTF8, 0, bstr, blen, NULL, 0, NULL, NULL );
-    str = HeapAlloc( GetProcessHeap(), 0, len );
+    str = heap_alloc( len );
     if ( !str )
         return FALSE;
     WideCharToMultiByte( CP_UTF8, 0, bstr, blen, str, len, NULL, NULL );
@@ -1630,7 +1630,7 @@ static HRESULT WINAPI domdoc_loadXML(
         if ( bstrXML  && bstr_to_utf8( bstrXML, &str, &len ) )
         {
             xmldoc = doparse( str, len );
-            HeapFree( GetProcessHeap(), 0, str );
+            heap_free( str );
             if ( !xmldoc )
                 This->error = E_FAIL;
             else
@@ -2204,7 +2204,7 @@ HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **docu
 {
     domdoc *doc;
 
-    doc = HeapAlloc( GetProcessHeap(), 0, sizeof (*doc) );
+    doc = heap_alloc( sizeof (*doc) );
     if( !doc )
         return E_OUTOFMEMORY;
 
diff --git a/dlls/msxml3/domimpl.c b/dlls/msxml3/domimpl.c
index b0b1cde..1a07676 100644
--- a/dlls/msxml3/domimpl.c
+++ b/dlls/msxml3/domimpl.c
@@ -89,7 +89,7 @@ static ULONG WINAPI dimimpl_Release(
     ref = InterlockedDecrement( &This->ref );
     if ( ref == 0 )
     {
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -216,7 +216,7 @@ IUnknown* create_doc_Implementation(void)
 {
     domimpl *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c
index e6f2f76..f7bd3b0 100644
--- a/dlls/msxml3/element.c
+++ b/dlls/msxml3/element.c
@@ -502,7 +502,7 @@ static HRESULT WINAPI domelem_get_tagName(
     len = MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) element->name, -1, NULL, 0 );
     if (element->ns)
         len += MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) element->ns->prefix, -1, NULL, 0 );
-    str = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) );
+    str = heap_alloc( len * sizeof (WCHAR) );
     if ( !str )
         return E_OUTOFMEMORY;
     if (element->ns)
@@ -512,7 +512,7 @@ static HRESULT WINAPI domelem_get_tagName(
     }
     MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) element->name, -1, str + offset, len - offset );
     *p = SysAllocString( str );
-    HeapFree( GetProcessHeap(), 0, str );
+    heap_free( str );
 
     return S_OK;
 }
@@ -545,7 +545,7 @@ static HRESULT WINAPI domelem_getAttribute(
     else
         xml_value = xmlGetNsProp(element, xml_name, NULL);
 
-    HeapFree(GetProcessHeap(), 0, xml_name);
+    heap_free(xml_name);
     if(xml_value)
     {
         V_VT(value) = VT_BSTR;
@@ -587,8 +587,8 @@ static HRESULT WINAPI domelem_setAttribute(
     if(!xmlSetNsProp(element, NULL,  xml_name, xml_value))
         hr = E_FAIL;
 
-    HeapFree(GetProcessHeap(), 0, xml_value);
-    HeapFree(GetProcessHeap(), 0, xml_name);
+    heap_free(xml_value);
+    heap_free(xml_name);
     VariantClear(&var);
 
     return hr;
@@ -639,7 +639,7 @@ static HRESULT WINAPI domelem_getAttributeNode(
 
     if(!xmlValidateNameValue(xml_name))
     {
-        HeapFree(GetProcessHeap(), 0, xml_name);
+        heap_free(xml_name);
         return E_FAIL;
     }
 
@@ -650,7 +650,7 @@ static HRESULT WINAPI domelem_getAttributeNode(
         IUnknown_Release(unk);
     }
 
-    HeapFree(GetProcessHeap(), 0, xml_name);
+    heap_free(xml_name);
 
     return hr;
 }
@@ -688,7 +688,7 @@ static HRESULT WINAPI domelem_getElementsByTagName(
 
     if (bstrName[0] == '*' && bstrName[1] == 0)
     {
-        szPattern = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*5);
+        szPattern = heap_alloc(sizeof(WCHAR)*5);
         szPattern[0] = '.';
         szPattern[1] = szPattern[2] = '/';
         szPattern[3] = '*';
@@ -696,7 +696,7 @@ static HRESULT WINAPI domelem_getElementsByTagName(
     }
     else
     {
-        szPattern = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(21+lstrlenW(bstrName)+1));
+        szPattern = heap_alloc(sizeof(WCHAR)*(21+lstrlenW(bstrName)+1));
         wsprintfW(szPattern, xpathformat, bstrName);
     }
     TRACE("%s\n", debugstr_w(szPattern));
@@ -706,7 +706,7 @@ static HRESULT WINAPI domelem_getElementsByTagName(
         hr = E_FAIL;
     else
         hr = queryresult_create(element, szPattern, resultList);
-    HeapFree(GetProcessHeap(), 0, szPattern);
+    heap_free(szPattern);
 
     return hr;
 }
@@ -790,7 +790,7 @@ IUnknown* create_element( xmlNodePtr element )
 {
     domelem *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c
index 7ba06c3..1489dbd 100644
--- a/dlls/msxml3/entityref.c
+++ b/dlls/msxml3/entityref.c
@@ -94,7 +94,7 @@ static ULONG WINAPI entityref_Release(
     if ( ref == 0 )
     {
         destroy_xmlnode(&This->node);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -518,7 +518,7 @@ IUnknown* create_doc_entity_ref( xmlNodePtr entity )
 {
     entityref *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/httprequest.c b/dlls/msxml3/httprequest.c
index bc0fe7c..a477753 100644
--- a/dlls/msxml3/httprequest.c
+++ b/dlls/msxml3/httprequest.c
@@ -83,7 +83,7 @@ static ULONG WINAPI httprequest_Release(IXMLHTTPRequest *iface)
     ref = InterlockedDecrement( &This->ref );
     if ( ref == 0 )
     {
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -317,7 +317,7 @@ HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, LPVOID *ppObj)
 
     TRACE("(%p,%p)\n", pUnkOuter, ppObj);
 
-    req = HeapAlloc( GetProcessHeap(), 0, sizeof (*req) );
+    req = heap_alloc( sizeof (*req) );
     if( !req )
         return E_OUTOFMEMORY;
 
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 82f4c56..6729512 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -130,7 +130,7 @@ static ULONG WINAPI xmlnode_Release(
     ref = InterlockedDecrement( &This->ref );
     if(!ref) {
         destroy_xmlnode(This);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -354,7 +354,7 @@ static HRESULT WINAPI xmlnode_put_nodeValue(
       {
         str = xmlChar_from_wchar(V_BSTR(&string_value));
         xmlNodeSetContent(This->node, str);
-        HeapFree(GetProcessHeap(),0,str);
+        heap_free(str);
         hr = S_OK;
         break;
       }
@@ -920,7 +920,7 @@ static HRESULT WINAPI xmlnode_put_text(
 
     /* Escape the string. */
     str2 = xmlEncodeEntitiesReentrant(This->node->doc, str);
-    HeapFree(GetProcessHeap(), 0, str);
+    heap_free(str);
 
     xmlNodeSetContent(This->node, str2);
     xmlFree(str2);
@@ -1284,7 +1284,7 @@ static HRESULT WINAPI xmlnode_put_dataType(
             else
                 ERR("Failed to Create Namepsace\n");
         }
-        HeapFree( GetProcessHeap(), 0, str );
+        heap_free( str );
     }
 
     return hr;
diff --git a/dlls/msxml3/nodelist.c b/dlls/msxml3/nodelist.c
index e4ae604..011fff0 100644
--- a/dlls/msxml3/nodelist.c
+++ b/dlls/msxml3/nodelist.c
@@ -104,7 +104,7 @@ static ULONG WINAPI xmlnodelist_Release(
     if ( ref == 0 )
     {
         xmldoc_release( This->parent->doc );
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -314,7 +314,7 @@ IXMLDOMNodeList* create_children_nodelist( xmlNodePtr node )
 {
     xmlnodelist *nodelist;
 
-    nodelist = HeapAlloc( GetProcessHeap(), 0, sizeof *nodelist );
+    nodelist = heap_alloc( sizeof *nodelist );
     if ( !nodelist )
         return NULL;
 
diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c
index 825abef..91f7a32 100644
--- a/dlls/msxml3/nodemap.c
+++ b/dlls/msxml3/nodemap.c
@@ -102,7 +102,7 @@ static ULONG WINAPI xmlnodemap_Release(
     if ( ref == 0 )
     {
         IXMLDOMNode_Release( This->node );
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -191,7 +191,7 @@ xmlChar *xmlChar_from_wchar( LPWSTR str )
     xmlChar *xmlstr;
 
     len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL );
-    xmlstr = HeapAlloc( GetProcessHeap(), 0, len );
+    xmlstr = heap_alloc( len );
     if ( xmlstr )
         WideCharToMultiByte( CP_UTF8, 0, str, -1, (LPSTR) xmlstr, len, NULL, NULL );
     return xmlstr;
@@ -218,7 +218,7 @@ static HRESULT WINAPI xmlnodemap_getNamedItem(
 
     element_name = xmlChar_from_wchar( name );
     attr = xmlHasNsProp( node, element_name, NULL );
-    HeapFree( GetProcessHeap(), 0, element_name );
+    heap_free( element_name );
 
     if ( !attr )
     {
@@ -303,7 +303,7 @@ static HRESULT WINAPI xmlnodemap_removeNamedItem(
 
     element_name = xmlChar_from_wchar( name );
     attr = xmlHasNsProp( node, element_name, NULL );
-    HeapFree( GetProcessHeap(), 0, element_name );
+    heap_free( element_name );
 
     if ( !attr )
     {
@@ -531,7 +531,7 @@ IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node )
 {
     xmlnodemap *nodemap;
 
-    nodemap = HeapAlloc( GetProcessHeap(), 0, sizeof *nodemap );
+    nodemap = heap_alloc( sizeof *nodemap );
     if ( !nodemap )
         return NULL;
 
diff --git a/dlls/msxml3/parseerror.c b/dlls/msxml3/parseerror.c
index b78f829..40b17a0 100644
--- a/dlls/msxml3/parseerror.c
+++ b/dlls/msxml3/parseerror.c
@@ -97,7 +97,7 @@ static ULONG WINAPI parseError_Release(
         SysFreeString(This->url);
         SysFreeString(This->reason);
         SysFreeString(This->srcText);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -283,7 +283,7 @@ IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR src
 {
     parse_error_t *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof(*This) );
+    This = heap_alloc( sizeof(*This) );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c
index e814b8d..f32cebf 100644
--- a/dlls/msxml3/pi.c
+++ b/dlls/msxml3/pi.c
@@ -94,7 +94,7 @@ static ULONG WINAPI dom_pi_Release(
     if ( ref == 0 )
     {
         destroy_xmlnode(&This->node);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -604,7 +604,7 @@ IUnknown* create_pi( xmlNodePtr pi )
 {
     dom_pi *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/queryresult.c b/dlls/msxml3/queryresult.c
index 50e8b79..ab54596 100644
--- a/dlls/msxml3/queryresult.c
+++ b/dlls/msxml3/queryresult.c
@@ -413,7 +413,7 @@ cleanup:
         IXMLDOMNodeList_Release( (IXMLDOMNodeList*) &This->lpVtbl );
     if (ctxt != NULL)
         xmlXPathFreeContext(ctxt);
-    HeapFree(GetProcessHeap(), 0, str);
+    heap_free(str);
     return hr;
 }
 
diff --git a/dlls/msxml3/saxreader.c b/dlls/msxml3/saxreader.c
index ff8b41a..a3de757 100644
--- a/dlls/msxml3/saxreader.c
+++ b/dlls/msxml3/saxreader.c
@@ -166,13 +166,13 @@ static BSTR bstr_from_xmlCharN(const xmlChar *buf, int len)
 
     dLen = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, NULL, 0);
     if(len != -1) dLen++;
-    str = HeapAlloc(GetProcessHeap(), 0, dLen * sizeof (WCHAR));
+    str = heap_alloc(dLen * sizeof (WCHAR));
     if (!str)
         return NULL;
     MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)buf, len, str, dLen);
     if(len != -1) str[dLen-1] = '\0';
     bstr = SysAllocString(str);
-    HeapFree(GetProcessHeap(), 0, str);
+    heap_free(str);
 
     return bstr;
 }
@@ -190,7 +190,7 @@ static BSTR QName_from_xmlChar(const xmlChar *prefix, const xmlChar *name)
 
     dLen = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)prefix, -1, NULL, 0)
         + MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, NULL, 0);
-    str = HeapAlloc(GetProcessHeap(), 0, dLen * sizeof(WCHAR));
+    str = heap_alloc(dLen * sizeof(WCHAR));
     if(!str)
         return NULL;
 
@@ -199,7 +199,7 @@ static BSTR QName_from_xmlChar(const xmlChar *prefix, const xmlChar *name)
     MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)name, -1, &str[dLast], dLen-dLast);
     bstr = SysAllocString(str);
 
-    HeapFree(GetProcessHeap(), 0, str);
+    heap_free(str);
 
     return bstr;
 }
@@ -629,12 +629,12 @@ static ULONG WINAPI isaxattributes_Release(ISAXAttributes* iface)
             SysFreeString(This->szQName[index]);
         }
 
-        HeapFree(GetProcessHeap(), 0, This->szLocalname);
-        HeapFree(GetProcessHeap(), 0, This->szURI);
-        HeapFree(GetProcessHeap(), 0, This->szValue);
-        HeapFree(GetProcessHeap(), 0, This->szQName);
+        heap_free(This->szLocalname);
+        heap_free(This->szURI);
+        heap_free(This->szValue);
+        heap_free(This->szQName);
 
-        HeapFree(GetProcessHeap(), 0, This);
+        heap_free(This);
     }
 
     return ref;
@@ -919,7 +919,7 @@ static HRESULT SAXAttributes_create(saxattributes **attr,
     int index;
     static const xmlChar xmlns[] = "xmlns";
 
-    attributes = HeapAlloc(GetProcessHeap(), 0, sizeof(*attributes));
+    attributes = heap_alloc(sizeof(*attributes));
     if(!attributes)
         return E_OUTOFMEMORY;
 
@@ -929,23 +929,19 @@ static HRESULT SAXAttributes_create(saxattributes **attr,
 
     attributes->nb_attributes = nb_namespaces+nb_attributes;
 
-    attributes->szLocalname =
-        HeapAlloc(GetProcessHeap(), 0, sizeof(BSTR)*attributes->nb_attributes);
-    attributes->szURI =
-        HeapAlloc(GetProcessHeap(), 0, sizeof(BSTR)*attributes->nb_attributes);
-    attributes->szValue =
-        HeapAlloc(GetProcessHeap(), 0, sizeof(BSTR)*attributes->nb_attributes);
-    attributes->szQName =
-        HeapAlloc(GetProcessHeap(), 0, sizeof(BSTR)*attributes->nb_attributes);
+    attributes->szLocalname = heap_alloc(sizeof(BSTR)*attributes->nb_attributes);
+    attributes->szURI = heap_alloc(sizeof(BSTR)*attributes->nb_attributes);
+    attributes->szValue = heap_alloc(sizeof(BSTR)*attributes->nb_attributes);
+    attributes->szQName = heap_alloc(sizeof(BSTR)*attributes->nb_attributes);
 
     if(!attributes->szLocalname || !attributes->szURI
             || !attributes->szValue || !attributes->szQName)
     {
-        HeapFree(GetProcessHeap(), 0, attributes->szLocalname);
-        HeapFree(GetProcessHeap(), 0, attributes->szURI);
-        HeapFree(GetProcessHeap(), 0, attributes->szValue);
-        HeapFree(GetProcessHeap(), 0, attributes->szQName);
-        HeapFree(GetProcessHeap(), 0, attributes);
+        heap_free(attributes->szLocalname);
+        heap_free(attributes->szURI);
+        heap_free(attributes->szValue);
+        heap_free(attributes->szQName);
+        heap_free(attributes);
         return E_FAIL;
     }
 
@@ -1319,7 +1315,7 @@ static void libxmlFatalError(void *ctx, const char *msg, ...)
     va_end(args);
 
     len = MultiByteToWideChar(CP_UNIXCP, 0, message, -1, NULL, 0);
-    wszError = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*len);
+    wszError = heap_alloc(sizeof(WCHAR)*len);
     if(wszError)
         MultiByteToWideChar(CP_UNIXCP, 0, message, -1, wszError, len);
 
@@ -1333,7 +1329,7 @@ static void libxmlFatalError(void *ctx, const char *msg, ...)
         ISAXErrorHandler_fatalError(This->saxreader->errorHandler,
                 (ISAXLocator*)&This->lpSAXLocatorVtbl, wszError, E_FAIL);
 
-    HeapFree(GetProcessHeap(), 0, wszError);
+    heap_free(wszError);
 
     xmlStopParser(This->pParserCtxt);
     This->ret = E_FAIL;
@@ -1643,10 +1639,10 @@ static ULONG WINAPI isaxlocator_Release(
     {
         SysFreeString(This->publicId);
         SysFreeString(This->systemId);
-        HeapFree(GetProcessHeap(), 0, This->nsStack);
+        heap_free(This->nsStack);
 
         ISAXXMLReader_Release((ISAXXMLReader*)&This->saxreader->lpSAXXMLReaderVtbl);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -1732,7 +1728,7 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B
 {
     saxlocator *locator;
 
-    locator = HeapAlloc( GetProcessHeap(), 0, sizeof (*locator) );
+    locator = heap_alloc( sizeof (*locator) );
     if( !locator )
         return E_OUTOFMEMORY;
 
@@ -1753,11 +1749,11 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B
     locator->ret = S_OK;
     locator->nsStackSize = 8;
     locator->nsStackLast = 0;
-    locator->nsStack = HeapAlloc(GetProcessHeap(), 0, locator->nsStackSize);
+    locator->nsStack = heap_alloc(locator->nsStackSize);
     if(!locator->nsStack)
     {
         ISAXXMLReader_Release((ISAXXMLReader*)&reader->lpSAXXMLReaderVtbl);
-        HeapFree(GetProcessHeap(), 0, locator);
+        heap_free(locator);
         return E_OUTOFMEMORY;
     }
 
@@ -2314,7 +2310,7 @@ static ULONG WINAPI saxxmlreader_Release(
         if(This->vbdeclHandler)
             IVBSAXDeclHandler_Release(This->vbdeclHandler);
 
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -2809,7 +2805,7 @@ HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj)
 
     TRACE("(%p,%p)\n", pUnkOuter, ppObj);
 
-    reader = HeapAlloc( GetProcessHeap(), 0, sizeof (*reader) );
+    reader = heap_alloc( sizeof (*reader) );
     if( !reader )
         return E_OUTOFMEMORY;
 
diff --git a/dlls/msxml3/schema.c b/dlls/msxml3/schema.c
index e71586e..f0a6169 100644
--- a/dlls/msxml3/schema.c
+++ b/dlls/msxml3/schema.c
@@ -86,7 +86,7 @@ static ULONG WINAPI schema_cache_Release( IXMLDOMSchemaCollection *iface )
 
     if ( ref == 0 )
     {
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -233,7 +233,7 @@ static const struct IXMLDOMSchemaCollectionVtbl schema_vtbl =
 
 HRESULT SchemaCache_create(IUnknown *pUnkOuter, LPVOID *ppObj)
 {
-    schema_t *schema = HeapAlloc( GetProcessHeap(), 0, sizeof (*schema) );
+    schema_t *schema = heap_alloc( sizeof (*schema) );
     if( !schema )
         return E_OUTOFMEMORY;
 
diff --git a/dlls/msxml3/text.c b/dlls/msxml3/text.c
index d9736b1..70ca3ef 100644
--- a/dlls/msxml3/text.c
+++ b/dlls/msxml3/text.c
@@ -103,7 +103,7 @@ static ULONG WINAPI domtext_Release(
     if ( ref == 0 )
     {
         destroy_xmlnode(&This->node);
-        HeapFree( GetProcessHeap(), 0, This );
+        heap_free( This );
     }
 
     return ref;
@@ -605,7 +605,7 @@ static HRESULT WINAPI domtext_appendData(
             hr = S_OK;
         else
             hr = E_FAIL;
-        HeapFree( GetProcessHeap(), 0, pContent );
+        heap_free( pContent );
     }
     else
         hr = E_FAIL;
@@ -669,7 +669,7 @@ static HRESULT WINAPI domtext_insertData(
                 xmlNodeSetContent(This->node.node, str);
                 hr = S_OK;
             }
-            HeapFree(GetProcessHeap(), 0, str);
+            heap_free(str);
 
             SysFreeString(sNewString);
         }
@@ -806,7 +806,7 @@ IUnknown* create_text( xmlNodePtr text )
 {
     domtext *This;
 
-    This = HeapAlloc( GetProcessHeap(), 0, sizeof *This );
+    This = heap_alloc( sizeof *This );
     if ( !This )
         return NULL;
 
diff --git a/dlls/msxml3/xmldoc.c b/dlls/msxml3/xmldoc.c
index b77fd00..d1a010f 100644
--- a/dlls/msxml3/xmldoc.c
+++ b/dlls/msxml3/xmldoc.c
@@ -117,7 +117,7 @@ static ULONG WINAPI xmldoc_Release(IXMLDocument *iface)
     {
         xmlFreeDoc(This->xmldoc);
         if (This->stream) IStream_Release(This->stream);
-        HeapFree(GetProcessHeap(), 0, This);
+        heap_free(This);
     }
 
     return ref;
@@ -698,7 +698,7 @@ HRESULT XMLDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
 
     TRACE("(%p,%p)\n", pUnkOuter, ppObj);
 
-    doc = HeapAlloc(GetProcessHeap(), 0, sizeof (*doc));
+    doc = heap_alloc(sizeof (*doc));
     if(!doc)
         return E_OUTOFMEMORY;
 
diff --git a/dlls/msxml3/xmlelem.c b/dlls/msxml3/xmlelem.c
index 3c1f4f2..3ff307b 100644
--- a/dlls/msxml3/xmlelem.c
+++ b/dlls/msxml3/xmlelem.c
@@ -96,7 +96,7 @@ static ULONG WINAPI xmlelem_Release(IXMLElement *iface)
     if (ref == 0)
     {
         if (This->own) xmlFreeNode(This->node);
-        HeapFree(GetProcessHeap(), 0, This);
+        heap_free(This);
     }
 
     return ref;
@@ -233,8 +233,8 @@ static HRESULT WINAPI xmlelem_setAttribute(IXMLElement *iface, BSTR strPropertyN
     value = xmlChar_from_wchar(V_BSTR(&PropertyValue));
     attr = xmlSetProp(This->node, name, value);
 
-    HeapFree(GetProcessHeap(), 0, name);
-    HeapFree(GetProcessHeap(), 0, value);
+    heap_free(name);
+    heap_free(value);
     return (attr) ? S_OK : S_FALSE;
 }
 
@@ -275,7 +275,7 @@ static HRESULT WINAPI xmlelem_getAttribute(IXMLElement *iface, BSTR strPropertyN
         V_BSTR(PropertyValue) = bstr_from_xmlChar(val);
     }
 
-    HeapFree(GetProcessHeap(), 0, name);
+    heap_free(name);
     xmlFree(val);
     TRACE("returning %s\n", debugstr_w(V_BSTR(PropertyValue)));
     return (val) ? S_OK : S_FALSE;
@@ -305,7 +305,7 @@ static HRESULT WINAPI xmlelem_removeAttribute(IXMLElement *iface, BSTR strProper
         hr = S_OK;
 
 done:
-    HeapFree(GetProcessHeap(), 0, name);
+    heap_free(name);
     return hr;
 }
 
@@ -390,7 +390,7 @@ static HRESULT WINAPI xmlelem_put_text(IXMLElement *iface, BSTR p)
     content = xmlChar_from_wchar(p);
     xmlNodeSetContent(This->node, content);
 
-    HeapFree( GetProcessHeap(), 0, content);
+    heap_free(content);
 
     return S_OK;
 }
@@ -470,7 +470,7 @@ HRESULT XMLElement_create(IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj, B
 
     *ppObj = NULL;
 
-    elem = HeapAlloc(GetProcessHeap(), 0, sizeof (*elem));
+    elem = heap_alloc(sizeof (*elem));
     if(!elem)
         return E_OUTOFMEMORY;
 
@@ -566,7 +566,7 @@ static ULONG WINAPI xmlelem_collection_Release(IXMLElementCollection *iface)
     ref = InterlockedDecrement(&This->ref);
     if (ref == 0)
     {
-        HeapFree(GetProcessHeap(), 0, This);
+        heap_free(This);
     }
 
     return ref;
@@ -767,7 +767,7 @@ static HRESULT XMLElementCollection_create(IUnknown *pUnkOuter, xmlNodePtr node,
     if (!node->children)
         return S_FALSE;
 
-    collection = HeapAlloc(GetProcessHeap(), 0, sizeof (*collection));
+    collection = heap_alloc(sizeof (*collection));
     if(!collection)
         return E_OUTOFMEMORY;
 
-- 
1.5.6.5


--=-N0+sn+S8+UNCnYbCgDeZ--




More information about the wine-patches mailing list