qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qcow2: remove useless NULL check


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] qcow2: remove useless NULL check
Date: Wed, 8 Feb 2017 07:53:14 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 02/08/2017 02:09 AM, Marc-André Lureau wrote:
> g_strdup() already handles the case where the argument is NULL.
> 
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  block/qcow2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Eric Blake <address@hidden>

> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 96fb8a8f16..9114218030 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2016,8 +2016,8 @@ static int qcow2_change_backing_file(BlockDriverState 
> *bs,
>      g_free(s->image_backing_file);
>      g_free(s->image_backing_format);
>  
> -    s->image_backing_file = backing_file ? g_strdup(bs->backing_file) : NULL;
> -    s->image_backing_format = backing_fmt ? g_strdup(bs->backing_format) : 
> NULL;
> +    s->image_backing_file = g_strdup(bs->backing_file);
> +    s->image_backing_format = g_strdup(bs->backing_format);
>  
>      return qcow2_update_header(bs);
>  }
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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