[PATCH] msxml3/tests: Use CRT memory allocation functions.

Nikolay Sivov nsivov at codeweavers.com
Fri Apr 1 02:34:14 CDT 2022


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/msxml3/tests/domdoc.c    |  5 ++---
 dlls/msxml3/tests/httpreq.c   |  5 ++---
 dlls/msxml3/tests/saxreader.c | 17 ++++++++---------
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index c6eeb012b68..0643ea5350f 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -43,7 +43,6 @@
 #include "asptlb.h"
 #include "shlwapi.h"
 
-#include "wine/heap.h"
 #include "wine/test.h"
 
 #define XML_E_UNEXPECTED_ATTRIBUTE 0xC00CE56C
@@ -193,7 +192,7 @@ static ULONG WINAPI dispevent_Release(IDispatch *iface)
     ULONG ref = InterlockedDecrement( &This->ref );
 
     if (ref == 0)
-        heap_free(This);
+        free(This);
 
     return ref;
 }
@@ -253,7 +252,7 @@ static const IDispatchVtbl dispeventVtbl =
 
 static IDispatch* create_dispevent(void)
 {
-    dispevent *event = heap_alloc(sizeof(*event));
+    dispevent *event = malloc(sizeof(*event));
 
     event->IDispatch_iface.lpVtbl = &dispeventVtbl;
     event->ref = 1;
diff --git a/dlls/msxml3/tests/httpreq.c b/dlls/msxml3/tests/httpreq.c
index bf52e71a6e7..bccfbaf582a 100644
--- a/dlls/msxml3/tests/httpreq.c
+++ b/dlls/msxml3/tests/httpreq.c
@@ -35,7 +35,6 @@
 #include "objsafe.h"
 #include "mshtml.h"
 
-#include "wine/heap.h"
 #include "wine/test.h"
 
 #define EXPECT_REF(node,ref) _expect_ref((IUnknown*)node, ref, __LINE__)
@@ -1250,7 +1249,7 @@ static ULONG WINAPI dispevent_Release(IDispatch *iface)
     ULONG ref = InterlockedDecrement( &This->ref );
 
     if (ref == 0)
-        heap_free(This);
+        free(This);
 
     return ref;
 }
@@ -1326,7 +1325,7 @@ static const IDispatchVtbl dispeventVtbl =
 
 static IDispatch* create_dispevent(void)
 {
-    dispevent *event = heap_alloc(sizeof(*event));
+    dispevent *event = malloc(sizeof(*event));
 
     event->IDispatch_iface.lpVtbl = &dispeventVtbl;
     event->ref = 1;
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index d8101c4ce94..e123d4eba5a 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -33,7 +33,6 @@
 #include "ocidl.h"
 #include "dispex.h"
 
-#include "wine/heap.h"
 #include "wine/test.h"
 
 #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
@@ -268,13 +267,13 @@ static void add_call(struct call_sequence **seq, int sequence_index,
     if (!call_seq->sequence)
     {
         call_seq->size = 10;
-        call_seq->sequence = heap_alloc(call_seq->size * sizeof (struct call_entry));
+        call_seq->sequence = malloc(call_seq->size * sizeof (struct call_entry));
     }
 
     if (call_seq->count == call_seq->size)
     {
         call_seq->size *= 2;
-        call_seq->sequence = heap_realloc(call_seq->sequence, call_seq->size * sizeof (struct call_entry));
+        call_seq->sequence = realloc(call_seq->sequence, call_seq->size * sizeof (struct call_entry));
     }
 
     assert(call_seq->sequence);
@@ -309,7 +308,7 @@ static inline void flush_sequence(struct call_sequence **seg, int sequence_index
             SysFreeString(call_seq->sequence[i].attributes[j].qnameW);
             SysFreeString(call_seq->sequence[i].attributes[j].valueW);
         }
-        heap_free(call_seq->sequence[i].attributes);
+        free(call_seq->sequence[i].attributes);
         call_seq->sequence[i].attr_count = 0;
 
         SysFreeString(call_seq->sequence[i].arg1W);
@@ -317,7 +316,7 @@ static inline void flush_sequence(struct call_sequence **seg, int sequence_index
         SysFreeString(call_seq->sequence[i].arg3W);
     }
 
-    heap_free(call_seq->sequence);
+    free(call_seq->sequence);
     call_seq->sequence = NULL;
     call_seq->count = call_seq->size = 0;
 }
@@ -544,7 +543,7 @@ static void init_call_sequences(struct call_sequence **seq, int n)
     int i;
 
     for (i = 0; i < n; i++)
-        seq[i] = heap_alloc_zero(sizeof(struct call_sequence));
+        seq[i] = calloc(1, sizeof(**seq));
 }
 
 static const WCHAR szSimpleXML[] =
@@ -1235,7 +1234,7 @@ static HRESULT WINAPI contentHandler_startElement(
         int i;
 
         struct attribute_entry *attr;
-        attr = heap_alloc_zero(len * sizeof(*attr));
+        attr = calloc(len, sizeof(*attr));
 
         v = VARIANT_TRUE;
         hr = ISAXXMLReader_getFeature(g_reader, _bstr_("http://xml.org/sax/features/namespaces"), &v);
@@ -3374,7 +3373,7 @@ static void test_mxwriter_flush(void)
     ok(pos2.QuadPart == 0, "expected stream beginning\n");
 
     len = 2048;
-    buff = heap_alloc(len + 1);
+    buff = malloc(len + 1);
     memset(buff, 'A', len);
     buff[len] = 0;
     hr = ISAXContentHandler_characters(content, _bstr_(buff), len);
@@ -3457,7 +3456,7 @@ static void test_mxwriter_flush(void)
     ok(SysStringLen(V_BSTR(&dest)) == len, "got len=%d, expected %d\n", SysStringLen(V_BSTR(&dest)), len);
     VariantClear(&dest);
 
-    heap_free(buff);
+    free(buff);
     ISAXContentHandler_Release(content);
     IStream_Release(stream);
     IMXWriter_Release(writer);
-- 
2.35.1




More information about the wine-devel mailing list