Simplify qemu_realloc()

No functional change.  Bonus: looks just like qemu_malloc() now.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Markus Armbruster 2009-12-14 10:48:05 +01:00 committed by Aurelien Jarno
parent e1c247d26c
commit f8b0953bd5
1 changed files with 3 additions and 5 deletions

View File

@ -61,12 +61,10 @@ void *qemu_malloc(size_t size)
void *qemu_realloc(void *ptr, size_t size)
{
if (size) {
return oom_check(realloc(ptr, size));
} else if (allow_zero_malloc()) {
return oom_check(realloc(ptr, size ? size : 1));
if (!size && !allow_zero_malloc()) {
abort();
}
abort();
return oom_check(realloc(ptr, size ? size : 1));
}
void *qemu_mallocz(size_t size)