* Crap! Fixed memory manager initialisation. And sticking that into the

0.6.1 tarball, no one will notice! (ha ha ha)
This commit is contained in:
Sam Hocevar
2007-01-25 19:55:20 +00:00
committed by sam
parent 19cd94ee16
commit 37c9de4c4a
3 changed files with 13 additions and 1 deletions
+9 -1
View File
@@ -102,6 +102,13 @@ static int dummy_offset = 0;
#define DUMMY_START ((uintptr_t)dummy_buffer)
#define DUMMY_STOP ((uintptr_t)dummy_buffer + DUMMY_BYTES)
void _zz_mem_init(void)
{
LOADSYM(calloc);
LOADSYM(malloc);
LOADSYM(realloc);
}
void *NEW(calloc)(size_t nmemb, size_t size)
{
void *ret;
@@ -144,7 +151,8 @@ void NEW(free)(void *ptr)
void *NEW(realloc)(void *ptr, size_t size)
{
void *ret;
if((uintptr_t)ptr >= DUMMY_START && (uintptr_t)ptr < DUMMY_STOP)
if(!ORIG(realloc)
|| ((uintptr_t)ptr >= DUMMY_START && (uintptr_t)ptr < DUMMY_STOP))
{
ret = dummy_buffer + dummy_offset;
memcpy(ret, ptr, size);
+1
View File
@@ -111,6 +111,7 @@ void _zz_init(void)
_zz_network = 1;
_zz_fd_init();
_zz_mem_init();
_zz_sys_init();
tmp = getenv("ZZUF_STDIN");
+3
View File
@@ -53,3 +53,6 @@ extern int _zz_memory;
extern int _zz_network;
extern int _zz_autoinc;
/* This function is needed to initialise memory functions */
extern void _zz_mem_init(void);