cc: provide fake realloc() for getenv()
This commit is contained in:
parent
20da5094d9
commit
d48dcf08aa
1 changed files with 19 additions and 4 deletions
|
@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue