summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorGreg Watson <jarrah@users.sourceforge.net>2004-03-13 03:40:03 +0000
committerGreg Watson <jarrah@users.sourceforge.net>2004-03-13 03:40:03 +0000
commit54b165820246b73cb23643aa8c3e2e8fb567e5ee (patch)
tree56552eeba6be8e713668edd1eea25084a2a43f2d /src/lib
parentef71326b8e4a2d5e69b8f1537b04c9257b7b8240 (diff)
downloadcoreboot-54b165820246b73cb23643aa8c3e2e8fb567e5ee.tar.xz
added realloc
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1408 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/malloc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/malloc.c b/src/lib/malloc.c
index bd403e47e9..4a60012500 100644
--- a/src/lib/malloc.c
+++ b/src/lib/malloc.c
@@ -46,6 +46,23 @@ void *malloc(size_t size)
return p;
}
+void *realloc(void *mem, size_t size)
+{
+ void *new_mem;
+
+ if (mem == 0)
+ return malloc(size);
+ if (size == 0) {
+ free(mem);
+ return 0;
+ }
+
+ new_mem = malloc(size);
+ memcpy(new_mem, mem, size);
+ free(mem);
+ return new_mem;
+}
+
void free(void *where)
{
/* Don't care */