> > 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 dummy functions are needed with spice-client.h include. > > After this patch, on channel-usbredir.c, we have a single #ifdef > USE_USBREDIR and the #else block is defined in the end of the file. > > This patch also adds #ifdef USE_USBREDIR for channel-usbredir-priv.h > as none those functions are defined when usbredir is disabled. > > Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx> Acked > --- > src/channel-usbredir-priv.h | 4 ++++ > src/channel-usbredir.c | 29 +++++++++++++---------------- > 2 files changed, 17 insertions(+), 16 deletions(-) > > diff --git a/src/channel-usbredir-priv.h b/src/channel-usbredir-priv.h > index 17e9716..1ea8a19 100644 > --- a/src/channel-usbredir-priv.h > +++ b/src/channel-usbredir-priv.h > @@ -21,6 +21,8 @@ > #ifndef __SPICE_CLIENT_USBREDIR_CHANNEL_PRIV_H__ > #define __SPICE_CLIENT_USBREDIR_CHANNEL_PRIV_H__ > > +#ifdef USE_USBREDIR > + > #include <libusb.h> > #include <usbredirfilter.h> > #include "spice-client.h" > @@ -71,4 +73,6 @@ void spice_usbredir_channel_get_guest_filter( > > G_END_DECLS > > +#endif /* USE_USBREDIR */ > + > #endif /* __SPICE_CLIENT_USBREDIR_CHANNEL_PRIV_H__ */ > 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 */ Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel