Re: [PATCHv2 21/22] cosmetic: return early if channel is not usb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'd remove the "cosmetic" from the subject line, and explain
in the longer log that the changes are just cosmetic and replace

if (SPICE_IS_USBREDIR_CHANNEL(channel)) {
    /* code */
}

with

if (!SPICE_IS_USBREDIR_CHANNEL(channel)) {
    return;
/* code */

On Wed, Nov 26, 2014 at 06:56:12PM +0100, Marc-André Lureau wrote:
> ---
>  gtk/usb-device-manager.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
> index a7b1140..7b27516 100644
> --- a/gtk/usb-device-manager.c
> +++ b/gtk/usb-device-manager.c
> @@ -758,14 +758,15 @@ static void channel_new(SpiceSession *session, SpiceChannel *channel,
>  {
>      SpiceUsbDeviceManager *self = user_data;
>  
> -    if (SPICE_IS_USBREDIR_CHANNEL(channel)) {
> -        spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel),
> -                                           self->priv->context);
> -        spice_channel_connect(channel);
> -        g_ptr_array_add(self->priv->channels, channel);
> +    if (!SPICE_IS_USBREDIR_CHANNEL(channel))
> +        return;
>  
> -        spice_usb_device_manager_check_redir_on_connect(self, channel);
> -    }
> +    spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel),
> +                                       self->priv->context);
> +    spice_channel_connect(channel);
> +    g_ptr_array_add(self->priv->channels, channel);
> +
> +    spice_usb_device_manager_check_redir_on_connect(self, channel);
>  }
>  
>  static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
> @@ -773,8 +774,10 @@ static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
>  {
>      SpiceUsbDeviceManager *self = user_data;
>  
> -    if (SPICE_IS_USBREDIR_CHANNEL(channel))
> -        g_ptr_array_remove(self->priv->channels, channel);
> +    if (!SPICE_IS_USBREDIR_CHANNEL(channel))
> +        return;
> +
> +    g_ptr_array_remove(self->priv->channels, channel);
>  }
>  
>  static void spice_usb_device_manager_auto_connect_cb(GObject      *gobject,
> -- 
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: pgpjLAyaCD8tb.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]