[WINE]
[reactos.git] / reactos / lib / 3rdparty / libwine / debug_ros.c
1 /* The use of these four functions was creating unwanted imports
2 * from msvcrt.dll in kernel32.dll. */
3
4 #define malloc libwine_malloc
5 #define free libwine_free
6 #define realloc libwine_realloc
7 #define _strdup libwine__strdup
8 #define interlocked_xchg_add InterlockedExchangeAdd
9
10 #include "debug.c"
11
12 __MINGW_ATTRIB_MALLOC
13 void *malloc(size_t size)
14 {
15 return LocalAlloc(0, size);
16 }
17
18 void free(void *ptr)
19 {
20 LocalFree(ptr);
21 }
22
23 void *realloc(void *ptr, size_t size)
24 {
25 if (ptr == NULL) return malloc(size);
26 return LocalReAlloc(ptr, size, LMEM_MOVEABLE);
27 }
28
29 __MINGW_ATTRIB_MALLOC
30 char *_strdup(const char *str)
31 {
32 char *newstr = malloc(strlen(str) + 1);
33 if (newstr) strcpy(newstr, str);
34 return newstr;
35 }