[Spice-commits] server/red-channel.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Jan 14 06:18:16 PST 2016


 server/red-channel.c |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

New commits:
commit eff5e83936a3fda970ef3576d7fb1990f03ac3f9
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Dec 18 11:15:13 2015 +0000

    channel: simplify red_channel_client_send_item
    
    Acked-by: Pavel Grunt <pgrunt at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/server/red-channel.c b/server/red-channel.c
index 704f319..306c87d 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -560,33 +560,26 @@ static void red_channel_client_send_ping(RedChannelClient *rcc)
 
 static void red_channel_client_send_item(RedChannelClient *rcc, PipeItem *item)
 {
-    int handled = TRUE;
-
     spice_assert(red_channel_client_no_item_being_sent(rcc));
     red_channel_client_reset_send_data(rcc);
     switch (item->type) {
         case PIPE_ITEM_TYPE_SET_ACK:
             red_channel_client_send_set_ack(rcc);
-            free(item);
             break;
         case PIPE_ITEM_TYPE_MIGRATE:
             red_channel_client_send_migrate(rcc);
-            free(item);
             break;
         case PIPE_ITEM_TYPE_EMPTY_MSG:
             red_channel_client_send_empty_msg(rcc, item);
-            free(item);
             break;
         case PIPE_ITEM_TYPE_PING:
             red_channel_client_send_ping(rcc);
-            free(item);
             break;
         default:
-            handled = FALSE;
-    }
-    if (!handled) {
-        rcc->channel->channel_cbs.send_item(rcc, item);
+            rcc->channel->channel_cbs.send_item(rcc, item);
+            return;
     }
+    free(item);
 }
 
 static void red_channel_client_release_item(RedChannelClient *rcc, PipeItem *item, int item_pushed)


More information about the Spice-commits mailing list