Skip to contentSkip to conversation

[6434] Fix bsd-user compile like r6412

Qemu-devel Blue Swirl 1 participant 1 message Jan 24, 2009

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Revision: 6434

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6434
Author:   blueswir1
Date:     2009-01-24 20:19:18 +0000 (Sat, 24 Jan 2009)

Log Message:
-----------
Fix bsd-user compile like r6412

Modified Paths:
--------------
trunk/bsd-user/mmap.c

Modified: trunk/bsd-user/mmap.c
===================================================================

bsd-user/mmap.c +13 -0
@@ -122,6 +122,19 @@
     munmap(p, *p);
 }
 
+void *qemu_realloc(void *ptr, size_t size)
+{
+    size_t old_size, copy;
+    void *new_ptr;
+
+    old_size = *(size_t *)((char *)ptr - 16);
+    copy = old_size < size ? old_size : size;
+    new_ptr = qemu_malloc(size);
+    memcpy(new_ptr, ptr, copy);
+    qemu_free(ptr);
+    return new_ptr;
+}
+
 /* NOTE: all the constants are the HOST ones, but addresses are target. */
 int target_mprotect(abi_ulong start, abi_ulong len, int prot)
 {