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

Christophe Fergeau cfergeau at redhat.com
Fri Aug 25 13:42:05 UTC 2017


On Fri, Aug 25, 2017 at 11:24:39AM +0100, Frediano Ziglio wrote:
> A RedChannelClient is always attached to a valid RedChannel.

Yup, RedChannelClient::channel is construct-only, and
RedChannelClient::constructed already assumes that it has a non-NULL
channel.

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

> 
> 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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list