summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cc
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-07-28 12:06:29 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-07-28 12:06:29 +0200
commitd48dcf08aa78e08ea17414cc59ea5210c4aad890 (patch)
treed204695495e46a6e32898492f164a98f30c4299e /sys/src/cmd/cc
parent20da5094d9398dd64ab89c7dfc99f53ce6500842 (diff)
cc: provide fake realloc() for getenv()
Diffstat (limited to 'sys/src/cmd/cc')
-rw-r--r--sys/src/cmd/cc/compat.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/src/cmd/cc/compat.c b/sys/src/cmd/cc/compat.c
index 0a7b1fea8..c76ab9968 100644
--- a/sys/src/cmd/cc/compat.c
+++ b/sys/src/cmd/cc/compat.c
@@ -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)
+{
+}