* 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:
+9
-1
@@ -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);
|
||||
|
||||
@@ -111,6 +111,7 @@ void _zz_init(void)
|
||||
_zz_network = 1;
|
||||
|
||||
_zz_fd_init();
|
||||
_zz_mem_init();
|
||||
_zz_sys_init();
|
||||
|
||||
tmp = getenv("ZZUF_STDIN");
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user