Hi, On Sat, May 04, 2019 at 01:52:49PM -0400, Frediano Ziglio wrote: > > > > From: Victor Toso <me@xxxxxxxxxxxxxx> > > > > Not really interesting to keep tracking what is inside or not > > USE_USBREDIR on channel-usbredir itself. When usbredir is disabled, > > just a dummy functions are needed with a basic spice-client.h include. > > > > After this patch, we have a single #ifdef USE_USBREDIR and the #else > > (when it is disabled) is defined in the end of the file. > > > > Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx> > > It seems good, I would add something like this > > https://gitlab.freedesktop.org/fziglio/spice-gtk/commit/b9a9fc8f886f36826152bf41bbeb2ac3f6732c81 Sounds reasonable. I'll add a line about it in the commit log and send v2 as this extends what I proposed but still related ;) Thanks, > > --- > > src/channel-usbredir.c | 29 +++++++++++++---------------- > > 1 file changed, 13 insertions(+), 16 deletions(-) > > > > diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c > > index f801c8e..1910ff6 100644 > > --- a/src/channel-usbredir.c > > +++ b/src/channel-usbredir.c > > @@ -33,7 +33,6 @@ > > #include "channel-usbredir-priv.h" > > #include "usb-device-manager-priv.h" > > #include "usbutil.h" > > -#endif > > > > #include "common/log.h" > > #include "spice-client.h" > > @@ -53,8 +52,6 @@ > > * from the Spice client to the VM. This channel handles these messages. > > */ > > > > -#ifdef USE_USBREDIR > > - > > #define COMPRESS_THRESHOLD 1000 > > enum SpiceUsbredirChannelState { > > STATE_DISCONNECTED, > > @@ -102,23 +99,16 @@ static void usbredir_unlock_lock(void *user_data); > > static void usbredir_free_lock(void *user_data); > > > > G_DEFINE_TYPE_WITH_PRIVATE(SpiceUsbredirChannel, spice_usbredir_channel, > > SPICE_TYPE_CHANNEL) > > -#else > > -G_DEFINE_TYPE(SpiceUsbredirChannel, spice_usbredir_channel, > > SPICE_TYPE_CHANNEL) > > -#endif > > > > > > /* ------------------------------------------------------------------ */ > > > > static void spice_usbredir_channel_init(SpiceUsbredirChannel *channel) > > { > > -#ifdef USE_USBREDIR > > channel->priv = spice_usbredir_channel_get_instance_private(channel); > > g_mutex_init(&channel->priv->device_connect_mutex); > > -#endif > > } > > > > -#ifdef USE_USBREDIR > > - > > static void _channel_reset_finish(SpiceUsbredirChannel *channel, gboolean > > migrating) > > { > > SpiceUsbredirChannelPrivate *priv = channel->priv; > > @@ -176,11 +166,9 @@ static void spice_usbredir_channel_reset(SpiceChannel > > *c, gboolean migrating) > > > > _channel_reset_finish(channel, migrating); > > } > > -#endif > > > > static void spice_usbredir_channel_class_init(SpiceUsbredirChannelClass > > *klass) > > { > > -#ifdef USE_USBREDIR > > GObjectClass *gobject_class = G_OBJECT_CLASS(klass); > > SpiceChannelClass *channel_class = SPICE_CHANNEL_CLASS(klass); > > > > @@ -190,10 +178,8 @@ static void > > spice_usbredir_channel_class_init(SpiceUsbredirChannelClass *klass) > > channel_class->channel_reset = spice_usbredir_channel_reset; > > > > channel_set_handlers(SPICE_CHANNEL_CLASS(klass)); > > -#endif > > } > > > > -#ifdef USE_USBREDIR > > static void spice_usbredir_channel_dispose(GObject *obj) > > { > > SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(obj); > > @@ -236,9 +222,7 @@ static void spice_usbredir_channel_finalize(GObject *obj) > > > > if (channel->priv->host) > > usbredirhost_close(channel->priv->host); > > -#ifdef USE_USBREDIR > > g_mutex_clear(&channel->priv->device_connect_mutex); > > -#endif > > > > /* Chain up to the parent class */ > > if (G_OBJECT_CLASS(spice_usbredir_channel_parent_class)->finalize) > > @@ -946,4 +930,17 @@ static void usbredir_handle_msg(SpiceChannel *c, > > SpiceMsgIn *in) > > } > > } > > > > +#else > > +#include "spice-client.h" > > + > > +G_DEFINE_TYPE(SpiceUsbredirChannel, spice_usbredir_channel, > > SPICE_TYPE_CHANNEL) > > + > > +static void spice_usbredir_channel_init(SpiceUsbredirChannel *channel) > > +{ > > +} > > + > > +static void spice_usbredir_channel_class_init(SpiceUsbredirChannelClass > > *klass) > > +{ > > +} > > + > > #endif /* USE_USBREDIR */ > > CI results at https://gitlab.freedesktop.org/fziglio/spice-gtk/pipelines/35097 > > Frediano
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel