qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] block: remove redundant check before g_slist_fi


From: Alexander Yarygin
Subject: Re: [Qemu-devel] [PATCH] block: remove redundant check before g_slist_find()
Date: Mon, 29 Jun 2015 16:32:49 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Alberto Garcia <address@hidden> writes:

> An empty GSList is represented by a NULL pointer, therefore it's a
> perfectly valid argument for g_slist_find() and there's no need to
> make any additional check.
>
> Signed-off-by: Alberto Garcia <address@hidden>
> ---
>  block/io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/io.c b/block/io.c
> index e295992..2f7f889 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -283,7 +283,7 @@ void bdrv_drain_all(void)
>          }
>          aio_context_release(aio_context);
>
> -        if (!aio_ctxs || !g_slist_find(aio_ctxs, aio_context)) {
> +        if (!g_slist_find(aio_ctxs, aio_context)) {
>              aio_ctxs = g_slist_prepend(aio_ctxs, aio_context);
>          }
>      }

Seems ok to me.




reply via email to

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