cc: provide fake realloc() for getenv()

This commit is contained in:
cinap_lenrek 2015-07-28 12:06:29 +02:00
parent 20da5094d9
commit d48dcf08aa

View file

@ -17,11 +17,21 @@ calloc(ulong m, ulong n)
}
void*
realloc(void*, ulong)
realloc(void *o, ulong n)
{
fprint(2, "realloc called\n");
abort();
return 0;
ulong m;
void *a;
if(n == 0)
return nil;
if(o == nil)
return alloc(n);
a = alloc(n);
m = (char*)a - (char*)o;
if(m < n)
n = m;
memmove(a, o, n);
return a;
}
void
@ -45,3 +55,8 @@ void
setmalloctag(void*, uintptr)
{
}
void
setrealloctag(void*, uintptr)
{
}