Commit 787ba407 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

Fixed preloading.

darcs-hash:20050911224617-65a35-bcb82cf31e336128b34327940ae1078d140022ea.gz
parent a3e14d8b
......@@ -348,8 +348,7 @@ void *sub_alloc(su_home_t *home,
long size,
int zero)
{
void *data;
int preload = 0;
void *data, *preload = NULL;
assert (size >= 0);
......@@ -393,15 +392,15 @@ void *sub_alloc(su_home_t *home,
int prused = sub->sub_prused + size + MEMCHECK_EXTRA;
prused = ALIGN(prused);
if (prused <= sub->sub_prsize) {
preload = sub->sub_prused;
preload = (char *)sub->sub_preload + sub->sub_prused;
sub->sub_prused = prused;
}
}
if (preload && zero)
data = memset((char *)sub->sub_preload + preload, 0, size);
data = memset(preload, 0, size);
else if (preload)
data = (char *)sub->sub_preload + preload;
data = preload;
else if (zero)
data = calloc(1, size + MEMCHECK_EXTRA);
else
......
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