Changed to a separat heap for malloc/calloc/realloc/free.

svn path=/trunk/; revision=2806
This commit is contained in:
Hartmut Birr 2002-04-01 22:03:13 +00:00
parent ae374594ce
commit 7497838509

View file

@ -1,23 +1,24 @@
#include <windows.h> #include <windows.h>
#include <msvcrt/stdlib.h> #include <msvcrt/stdlib.h>
extern HANDLE hHeap;
void* malloc(size_t _size) void* malloc(size_t _size)
{ {
return(HeapAlloc(GetProcessHeap(),0,_size)); return HeapAlloc(hHeap, HEAP_ZERO_MEMORY, _size);
} }
void free(void* _ptr) void free(void* _ptr)
{ {
HeapFree(GetProcessHeap(),0,_ptr); HeapFree(hHeap,0,_ptr);
} }
void* calloc(size_t _nmemb, size_t _size) void* calloc(size_t _nmemb, size_t _size)
{ {
return(HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, _nmemb*_size)); return HeapAlloc(hHeap, HEAP_ZERO_MEMORY, _nmemb*_size);
} }
void* realloc(void* _ptr, size_t _size) void* realloc(void* _ptr, size_t _size)
{ {
return(HeapReAlloc(GetProcessHeap(),0,_ptr,_size)); return HeapReAlloc(hHeap, 0, _ptr, _size);
} }