[Spice-devel] [PATCH 13/15] dc: join the two loop

Frediano Ziglio fziglio at redhat.com
Mon May 16 16:40:38 UTC 2016


They tested the same condition, no break in inside loop (which would
exit all loops)

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/display-channel.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/server/display-channel.c b/server/display-channel.c
index a54f561..906882d 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -509,18 +509,16 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
             dpi_ring_item = ring_get_head(&other_drawable->pipes);
             /* dpi contains a sublist of dcc's, ordered the same */
             while (worker_ring_item) {
-                while (worker_ring_item) {
-                    dcc = SPICE_CONTAINEROF(worker_ring_item, DisplayChannelClient,
-                                            common.base.channel_link);
-                    dpi = SPICE_CONTAINEROF(dpi_ring_item, RedDrawablePipeItem, base);
-                    if (dpi && dcc == dpi->dcc) {
-                        dpi_ring_item = ring_next(&other_drawable->pipes, dpi_ring_item);
-                    } else {
-                        dcc_prepend_drawable(dcc, drawable);
-                    }
-                    worker_ring_item = ring_next(&RED_CHANNEL(display)->clients,
-                                                 worker_ring_item);
+                dcc = SPICE_CONTAINEROF(worker_ring_item, DisplayChannelClient,
+                                        common.base.channel_link);
+                dpi = SPICE_CONTAINEROF(dpi_ring_item, RedDrawablePipeItem, base);
+                if (dpi && dcc == dpi->dcc) {
+                    dpi_ring_item = ring_next(&other_drawable->pipes, dpi_ring_item);
+                } else {
+                    dcc_prepend_drawable(dcc, drawable);
                 }
+                worker_ring_item = ring_next(&RED_CHANNEL(display)->clients,
+                                             worker_ring_item);
             }
             /* not sending other_drawable where possible */
             drawable_remove_from_pipes(other_drawable);
-- 
2.7.4



More information about the Spice-devel mailing list