Commit 004c9ef410ec2f88552708cf1e01e91a91a143ed
1 parent
ac2e8522
Fix bsd-user compile like r6412
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6434 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
13 additions
and
0 deletions
bsd-user/mmap.c
... | ... | @@ -122,6 +122,19 @@ void qemu_free(void *ptr) |
122 | 122 | munmap(p, *p); |
123 | 123 | } |
124 | 124 | |
125 | +void *qemu_realloc(void *ptr, size_t size) | |
126 | +{ | |
127 | + size_t old_size, copy; | |
128 | + void *new_ptr; | |
129 | + | |
130 | + old_size = *(size_t *)((char *)ptr - 16); | |
131 | + copy = old_size < size ? old_size : size; | |
132 | + new_ptr = qemu_malloc(size); | |
133 | + memcpy(new_ptr, ptr, copy); | |
134 | + qemu_free(ptr); | |
135 | + return new_ptr; | |
136 | +} | |
137 | + | |
125 | 138 | /* NOTE: all the constants are the HOST ones, but addresses are target. */ |
126 | 139 | int target_mprotect(abi_ulong start, abi_ulong len, int prot) |
127 | 140 | { | ... | ... |