* [Qemu-devel] [PATCH] block: remove redundant check before g_slist_find()
@ 2015-06-29 13:12 Alberto Garcia
2015-06-29 13:32 ` Alexander Yarygin
2015-06-30 12:54 ` Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Alberto Garcia @ 2015-06-29 13:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Alberto Garcia, Stefan Hajnoczi, qemu-block, Alexander Yarygin
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 <berto@igalia.com>
---
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);
}
}
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] block: remove redundant check before g_slist_find()
2015-06-29 13:12 [Qemu-devel] [PATCH] block: remove redundant check before g_slist_find() Alberto Garcia
@ 2015-06-29 13:32 ` Alexander Yarygin
2015-06-30 12:54 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Yarygin @ 2015-06-29 13:32 UTC (permalink / raw)
To: Alberto Garcia; +Cc: Stefan Hajnoczi, qemu-devel, qemu-block
Alberto Garcia <berto@igalia.com> 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 <berto@igalia.com>
> ---
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] block: remove redundant check before g_slist_find()
2015-06-29 13:12 [Qemu-devel] [PATCH] block: remove redundant check before g_slist_find() Alberto Garcia
2015-06-29 13:32 ` Alexander Yarygin
@ 2015-06-30 12:54 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2015-06-30 12:54 UTC (permalink / raw)
To: Alberto Garcia; +Cc: qemu-devel, qemu-block, Alexander Yarygin
[-- Attachment #1: Type: text/plain, Size: 465 bytes --]
On Mon, Jun 29, 2015 at 04:12:13PM +0300, Alberto Garcia wrote:
> 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 <berto@igalia.com>
> ---
> block/io.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-30 12:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-29 13:12 [Qemu-devel] [PATCH] block: remove redundant check before g_slist_find() Alberto Garcia
2015-06-29 13:32 ` Alexander Yarygin
2015-06-30 12:54 ` Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.