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* void*
realloc(void*, ulong) realloc(void *o, ulong n)
{ {
fprint(2, "realloc called\n"); ulong m;
abort(); void *a;
return 0;
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 void
@ -45,3 +55,8 @@ void
setmalloctag(void*, uintptr) setmalloctag(void*, uintptr)
{ {
} }
void
setrealloctag(void*, uintptr)
{
}