dlls/ntdll/tests/rtlstr.c: change malloc/free to HeapAlloc/HeapFree

Zac Brown zac at zacbrown.org
Sat Nov 24 12:29:24 CST 2007


Hi,

Per the link: http://wiki.winehq.org/ReplaceMalloc, I've done this for
ntdll/tests/rtlstr.c.

Changelog:
* change malloc/free to HeapAlloc/HeapFree


-Zac



---
 dlls/ntdll/tests/rtlstr.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c
index 61da443..22f622b 100644
--- a/dlls/ntdll/tests/rtlstr.c
+++ b/dlls/ntdll/tests/rtlstr.c
@@ -89,7 +89,7 @@ static WCHAR* AtoW( const char* p )
 {
     WCHAR* buffer;
     DWORD len = MultiByteToWideChar( CP_ACP, 0, p, -1, NULL, 0 );
-    buffer = malloc( len * sizeof(WCHAR) );
+    buffer = HeapAlloc(GetProcessHeap(), NULL, len * sizeof(WCHAR));
     MultiByteToWideChar( CP_ACP, 0, p, -1, buffer, len );
     return buffer;
 }
@@ -191,7 +191,7 @@ static void test_RtlInitUnicodeStringEx(void)
     UNICODE_STRING uni;
     NTSTATUS result;

-    teststring2 = (WCHAR *) malloc((TESTSTRING2_LEN + 1) * sizeof(WCHAR));
+    teststring2 = HeapAlloc(GetProcessHeap(), NULL, (TESTSTRING2_LEN +
1) * sizeof(WCHAR));
     memset(teststring2, 'X', TESTSTRING2_LEN * sizeof(WCHAR));
     teststring2[TESTSTRING2_LEN] = '\0';

@@ -289,8 +289,7 @@ static void test_RtlInitUnicodeStringEx(void)
     ok(uni.Buffer == NULL,
        "pRtlInitUnicodeString(&uni, 0) sets Buffer to %p, expected %p\n",
        uni.Buffer, NULL);
-
-    free(teststring2);
+    HeapFree(GetProcessHeap(), NULL, teststring2);
 }


@@ -1354,7 +1353,7 @@ static void test_RtlUnicodeStringToInteger(void)
 	ok(value == str2int[test_num].value,
 	   "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) assigns
value %d, expected: %d\n",
 	   test_num, str2int[test_num].str, str2int[test_num].base, value,
str2int[test_num].value);
-	free(wstr);
+    HeapFree(GetProcessHeap(), NULL, wstr);
     }

     wstr = AtoW(str2int[1].str);
@@ -1395,7 +1394,7 @@ static void test_RtlUnicodeStringToInteger(void)
        "didn't return expected value (test c): expected: %d, got: %d\n",
        1, value);
     /* w2k: uni.Length = 0 returns value 11234567 instead of 0 */
-    free(wstr);
+    HeapFree(GetProcessHeap(), NULL, wstr);
 }


-- 
1.5.2.5



More information about the wine-patches mailing list