[Spice-devel] [PATCH spice-server 1/3] red-qxl: Remove redundant checks

Frediano Ziglio fziglio at redhat.com
Fri Aug 25 10:24:39 UTC 2017


A RedChannelClient is always attached to a valid RedChannel.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-qxl.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/server/red-qxl.c b/server/red-qxl.c
index 53f3338b..ba869e54 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -99,10 +99,6 @@ static void red_qxl_disconnect_display_peer(RedChannelClient *rcc)
     Dispatcher *dispatcher;
     RedChannel *channel = red_channel_client_get_channel(rcc);
 
-    if (!channel) {
-        return;
-    }
-
     dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
 
     spice_printerr("");
@@ -122,9 +118,6 @@ static void red_qxl_display_migrate(RedChannelClient *rcc)
     RedChannel *channel = red_channel_client_get_channel(rcc);
     uint32_t type, id;
 
-    if (!channel) {
-        return;
-    }
     g_object_get(channel, "channel-type", &type, "id", &id, NULL);
     dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
     spice_printerr("channel type %u id %u", type, id);
@@ -157,10 +150,6 @@ static void red_qxl_disconnect_cursor_peer(RedChannelClient *rcc)
     Dispatcher *dispatcher;
     RedChannel *channel = red_channel_client_get_channel(rcc);
 
-    if (!channel) {
-        return;
-    }
-
     dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
     spice_printerr("");
     payload.rcc = rcc;
@@ -177,9 +166,6 @@ static void red_qxl_cursor_migrate(RedChannelClient *rcc)
     RedChannel *channel = red_channel_client_get_channel(rcc);
     uint32_t type, id;
 
-    if (!channel) {
-        return;
-    }
     g_object_get(channel, "channel-type", &type, "id", &id, NULL);
     dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
     spice_printerr("channel type %u id %u", type, id);
-- 
2.13.5



More information about the Spice-devel mailing list