[Spice-devel] [PATCHv2 21/22] cosmetic: return early if channel is not usb
Christophe Fergeau
cfergeau at redhat.com
Thu Nov 27 07:35:17 PST 2014
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 at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141127/020f1ef1/attachment.sig>
More information about the Spice-devel
mailing list