mirror of https://gitee.com/openkylin/qemu.git
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 New Issue