qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [FOR 0.12 PATCH] Simplify qemu_realloc()


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [FOR 0.12 PATCH] Simplify qemu_realloc()
Date: Tue, 23 Feb 2010 22:38:39 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Dec 14, 2009 at 10:48:05AM +0100, Markus Armbruster wrote:
> No functional change.  Bonus: looks just like qemu_malloc() now.
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> I tagged this "FOR 0.12" because I think you might want to consider it
> for 0.12, not because I think it must go into 0.12.

It's clearly too late for 0.12, but as your patch makes sense, I have
committed it to HEAD.

>  qemu-malloc.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/qemu-malloc.c b/qemu-malloc.c
> index 5d9e34d..6cdc5de 100644
> --- a/qemu-malloc.c
> +++ b/qemu-malloc.c
> @@ -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)
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
address@hidden                 http://www.aurel32.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]