block: remove redundant check before g_slist_find()
PATCH 1/1 block: remove redundant check before g_slist_find()
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 <[email protected]>
--- block/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/io.c +1 -1
@@ -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); } }
Signature · 1 line
2.1.4
Quoted 14 lines · Alberto Garcia
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 <[email protected]>--- block/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)block/io.c +0
-0
block/io.c void bdrv_drain_all(void) · line 289
Quoted 8 lines
block/io.c +1
-1@@ -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.
Stefan Hajnoczi
AppliedQuoted 8 lines · Alberto Garcia
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 <[email protected]>--- 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