From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9ZBF-00054f-G4 for qemu-devel@nongnu.org; Mon, 29 Jun 2015 09:33:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9ZB9-0001k5-U9 for qemu-devel@nongnu.org; Mon, 29 Jun 2015 09:33:01 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:40282) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9ZB9-0001jS-L0 for qemu-devel@nongnu.org; Mon, 29 Jun 2015 09:32:55 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Jun 2015 14:32:53 +0100 From: Alexander Yarygin References: <1435583533-5758-1-git-send-email-berto@igalia.com> Date: Mon, 29 Jun 2015 16:32:49 +0300 In-Reply-To: <1435583533-5758-1-git-send-email-berto@igalia.com> (Alberto Garcia's message of "Mon, 29 Jun 2015 16:12:13 +0300") Message-ID: <87bnfyd4hq.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] block: remove redundant check before g_slist_find() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, qemu-block@nongnu.org Alberto Garcia 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 > --- > 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.