summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
+{
+}