mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 01:43:39 +00:00
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:
parent
e1c247d26c
commit
f8b0953bd5
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue