[Spice-devel,01/15] dc: convert to infinite loop

Submitted by Frediano Ziglio on May 16, 2016, 4:40 p.m.

Details

Message ID 1463416840-30273-2-git-send-email-fziglio@redhat.com
State New
Headers show
Series "Simplify current_add_equal function loop" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio May 16, 2016, 4:40 p.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/display-channel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/server/display-channel.c b/server/display-channel.c
index 1f4d66f..171dfce 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -512,7 +512,10 @@  static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
                 dcc = SPICE_CONTAINEROF(worker_ring_item, DisplayChannelClient,
                                         common.base.channel_link);
                 dpi = SPICE_CONTAINEROF(dpi_ring_item, RedDrawablePipeItem, base);
-                while (worker_ring_item && (!dpi || dcc != dpi->dcc)) {
+                for (;;) {
+                    if (!worker_ring_item || (dpi && dcc == dpi->dcc)) {
+                        break;
+                    }
                     dcc_prepend_drawable(dcc, drawable);
                     worker_ring_item = ring_next(&RED_CHANNEL(display)->clients,
                                                  worker_ring_item);