Commit 7c05d390 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

avrt: Use CRT allocation functions.

parent 4782d0e0
...@@ -23,18 +23,17 @@ ...@@ -23,18 +23,17 @@
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "avrt.h" #include "avrt.h"
WINE_DEFAULT_DEBUG_CHANNEL(avrt); WINE_DEFAULT_DEBUG_CHANNEL(avrt);
static inline WCHAR *heap_strdupAW(const char *src) static inline WCHAR *strdupAW(const char *src)
{ {
int len; int len;
WCHAR *dst; WCHAR *dst;
if (!src) return NULL; if (!src) return NULL;
len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
if ((dst = heap_alloc(len * sizeof(*dst)))) MultiByteToWideChar(CP_ACP, 0, src, -1, dst, len); if ((dst = malloc(len * sizeof(*dst)))) MultiByteToWideChar(CP_ACP, 0, src, -1, dst, len);
return dst; return dst;
} }
...@@ -43,7 +42,7 @@ HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index) ...@@ -43,7 +42,7 @@ HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index)
WCHAR *nameW = NULL; WCHAR *nameW = NULL;
HANDLE ret; HANDLE ret;
if (name && !(nameW = heap_strdupAW(name))) if (name && !(nameW = strdupAW(name)))
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return NULL; return NULL;
...@@ -51,7 +50,7 @@ HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index) ...@@ -51,7 +50,7 @@ HANDLE WINAPI AvSetMmThreadCharacteristicsA(const char *name, DWORD *index)
ret = AvSetMmThreadCharacteristicsW(nameW, index); ret = AvSetMmThreadCharacteristicsW(nameW, index);
heap_free(nameW); free(nameW);
return ret; return ret;
} }
...@@ -97,13 +96,13 @@ HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(const char *task1, const char *ta ...@@ -97,13 +96,13 @@ HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(const char *task1, const char *ta
WCHAR *task1W = NULL, *task2W = NULL; WCHAR *task1W = NULL, *task2W = NULL;
HANDLE ret; HANDLE ret;
if (task1 && !(task1W = heap_strdupAW(task1))) if (task1 && !(task1W = strdupAW(task1)))
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return NULL; return NULL;
} }
if (task2 && !(task2W = heap_strdupAW(task2))) if (task2 && !(task2W = strdupAW(task2)))
{ {
SetLastError(ERROR_OUTOFMEMORY); SetLastError(ERROR_OUTOFMEMORY);
return NULL; return NULL;
...@@ -111,8 +110,8 @@ HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(const char *task1, const char *ta ...@@ -111,8 +110,8 @@ HANDLE WINAPI AvSetMmMaxThreadCharacteristicsA(const char *task1, const char *ta
ret = AvSetMmMaxThreadCharacteristicsW(task1W, task2W, index); ret = AvSetMmMaxThreadCharacteristicsW(task1W, task2W, index);
heap_free(task2W); free(task2W);
heap_free(task1W); free(task1W);
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment