Nikolay Sivov : explorerframe/tests: Use global memory allocation helpers.

Alexandre Julliard julliard at winehq.org
Mon Feb 26 13:42:18 CST 2018


Module: wine
Branch: master
Commit: 4f35819843da7ce3f8a36faa2c44f5af25018768
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4f35819843da7ce3f8a36faa2c44f5af25018768

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Feb 25 19:34:09 2018 +0300

explorerframe/tests: Use global memory allocation helpers.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/explorerframe/tests/msg.h  | 12 +++++-------
 dlls/explorerframe/tests/nstc.c |  7 ++++---
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/dlls/explorerframe/tests/msg.h b/dlls/explorerframe/tests/msg.h
index f5e20f7..857278e 100644
--- a/dlls/explorerframe/tests/msg.h
+++ b/dlls/explorerframe/tests/msg.h
@@ -20,6 +20,7 @@
 
 #include <assert.h>
 #include <windows.h>
+#include "wine/heap.h"
 #include "wine/test.h"
 
 /* undocumented SWP flags - from SDK 3.1 */
@@ -66,16 +67,13 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
     if (!msg_seq->sequence)
     {
         msg_seq->size = 10;
-        msg_seq->sequence = HeapAlloc(GetProcessHeap(), 0,
-                                      msg_seq->size * sizeof (struct message));
+        msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (struct message));
     }
 
     if (msg_seq->count == msg_seq->size)
     {
         msg_seq->size *= 2;
-        msg_seq->sequence = HeapReAlloc(GetProcessHeap(), 0,
-                                        msg_seq->sequence,
-                                        msg_seq->size * sizeof (struct message));
+        msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (struct message));
     }
 
     assert(msg_seq->sequence);
@@ -92,7 +90,7 @@ static void add_message(struct msg_sequence **seq, int sequence_index,
 static void flush_sequence(struct msg_sequence **seg, int sequence_index)
 {
     struct msg_sequence *msg_seq = seg[sequence_index];
-    HeapFree(GetProcessHeap(), 0, msg_seq->sequence);
+    heap_free(msg_seq->sequence);
     msg_seq->sequence = NULL;
     msg_seq->count = msg_seq->size = 0;
 }
@@ -112,5 +110,5 @@ static void init_msg_sequences(struct msg_sequence **seq, int n)
     int i;
 
     for (i = 0; i < n; i++)
-        seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct msg_sequence));
+        seq[i] = heap_alloc_zero(sizeof(struct msg_sequence));
 }
diff --git a/dlls/explorerframe/tests/nstc.c b/dlls/explorerframe/tests/nstc.c
index 1d1673c..44bdf31 100644
--- a/dlls/explorerframe/tests/nstc.c
+++ b/dlls/explorerframe/tests/nstc.c
@@ -363,7 +363,8 @@ static const INameSpaceTreeControlEventsVtbl vt_NSTCEvents = {
 static INameSpaceTreeControlEventsImpl *create_nstc_events(void)
 {
     INameSpaceTreeControlEventsImpl *This;
-    This = HeapAlloc(GetProcessHeap(), 0, sizeof(INameSpaceTreeControlEventsImpl));
+
+    This = heap_alloc(sizeof(*This));
     This->INameSpaceTreeControlEvents_iface.lpVtbl = &vt_NSTCEvents;
     This->ref = 1;
 
@@ -2377,8 +2378,8 @@ static void test_events(void)
     if(!res)
     {
         /* Freeing these prematurely causes a crash. */
-        HeapFree(GetProcessHeap(), 0, pnstceimpl);
-        HeapFree(GetProcessHeap(), 0, pnstceimpl2);
+        heap_free(pnstceimpl);
+        heap_free(pnstceimpl2);
     }
 
     IShellItem_Release(psi);




More information about the wine-cvs mailing list