Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> On Mon, Nov 20, 2017 at 03:52:27PM +0000, Frediano Ziglio wrote: > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > server/red-channel-client.h | 17 +------- > server/red-channel.h | 19 ++------- > server/red-client.h | 13 +----- > server/reds.c | 12 +----- > server/smartcard.c | 17 +------- > server/smartcard.h | 12 +----- > server/spicevmc.c | 98 ++++++++++++++------------------------------- > 7 files changed, 37 insertions(+), 151 deletions(-) > > diff --git a/server/red-channel-client.h b/server/red-channel-client.h > index cebdc072..1ca0ad71 100644 > --- a/server/red-channel-client.h > +++ b/server/red-channel-client.h > @@ -30,22 +30,7 @@ G_BEGIN_DECLS > > #define RED_TYPE_CHANNEL_CLIENT red_channel_client_get_type() > > -#define RED_CHANNEL_CLIENT(obj) \ > - (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHANNEL_CLIENT, RedChannelClient)) > -#define RED_CHANNEL_CLIENT_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHANNEL_CLIENT, RedChannelClientClass)) > -#define RED_IS_CHANNEL_CLIENT(obj) \ > - (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHANNEL_CLIENT)) > -#define RED_IS_CHANNEL_CLIENT_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHANNEL_CLIENT)) > -#define RED_CHANNEL_CLIENT_GET_CLASS(obj) \ > - (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHANNEL_CLIENT, RedChannelClientClass)) > - > -typedef struct RedChannelClient RedChannelClient; > -typedef struct RedChannelClientClass RedChannelClientClass; > -typedef struct RedChannelClientPrivate RedChannelClientPrivate; > - > -GType red_channel_client_get_type(void) G_GNUC_CONST; > +SPICE_DECLARE_TYPE(RedChannelClient, red_channel_client, CHANNEL_CLIENT); > > gboolean red_channel_client_is_connected(RedChannelClient *rcc); > void red_channel_client_default_migrate(RedChannelClient *rcc); > diff --git a/server/red-channel.h b/server/red-channel.h > index 9e64e8b1..44445ddb 100644 > --- a/server/red-channel.h > +++ b/server/red-channel.h > @@ -38,7 +38,9 @@ > > G_BEGIN_DECLS > > -typedef struct RedChannel RedChannel; > +SPICE_DECLARE_TYPE(RedChannel, red_channel, CHANNEL); > +#define RED_TYPE_CHANNEL red_channel_get_type() > + > typedef struct RedChannelClient RedChannelClient; > typedef struct RedClient RedClient; > typedef struct MainChannelClient MainChannelClient; > @@ -76,19 +78,6 @@ static inline gboolean test_capability(const uint32_t *caps, int num_caps, uint3 > return VD_AGENT_HAS_CAPABILITY(caps, num_caps, cap); > } > > -#define RED_TYPE_CHANNEL red_channel_get_type() > - > -#define RED_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHANNEL, RedChannel)) > -#define RED_CHANNEL_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHANNEL, RedChannelClass)) > -#define RED_IS_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHANNEL)) > -#define RED_IS_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHANNEL)) > -#define RED_CHANNEL_GET_CLASS(obj) \ > - (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHANNEL, RedChannelClass)) > - > -typedef struct RedChannelClass RedChannelClass; > -typedef struct RedChannelPrivate RedChannelPrivate; > - > struct RedChannel > { > GObject parent; > @@ -126,8 +115,6 @@ struct RedChannelClass > > /* Red Channel interface */ > > -GType red_channel_get_type(void) G_GNUC_CONST; > - > const char *red_channel_get_name(RedChannel *channel); > > void red_channel_add_client(RedChannel *channel, RedChannelClient *rcc); > diff --git a/server/red-client.h b/server/red-client.h > index 20e2dc26..3ee7accb 100644 > --- a/server/red-client.h > +++ b/server/red-client.h > @@ -25,20 +25,9 @@ > > G_BEGIN_DECLS > > +SPICE_DECLARE_TYPE(RedClient, red_client, CLIENT); > #define RED_TYPE_CLIENT red_client_get_type() > > -#define RED_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RED_TYPE_CLIENT, RedClient)) > -#define RED_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RED_TYPE_CLIENT, RedClientClass)) > -#define RED_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RED_TYPE_CLIENT)) > -#define RED_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RED_TYPE_CLIENT)) > -#define RED_CLIENT_GET_CLASS(obj) \ > - (G_TYPE_INSTANCE_GET_CLASS ((obj), RED_TYPE_CLIENT, RedClientClass)) > - > -typedef struct RedClient RedClient; > -typedef struct RedClientClass RedClientClass; > - > -GType red_client_get_type (void) G_GNUC_CONST; > - > RedClient *red_client_new(RedsState *reds, int migrated); > > /* > diff --git a/server/reds.c b/server/reds.c > index 0d0af05f..ebcbe496 100644 > --- a/server/reds.c > +++ b/server/reds.c > @@ -261,17 +261,9 @@ typedef struct __attribute__ ((__packed__)) VDInternalBuf { > u; > } VDInternalBuf; > > +SPICE_DECLARE_TYPE(RedCharDeviceVDIPort, red_char_device_vdi_port, CHAR_DEVICE_VDIPORT); > #define RED_TYPE_CHAR_DEVICE_VDIPORT red_char_device_vdi_port_get_type() > > -#define RED_CHAR_DEVICE_VDIPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_VDIPORT, RedCharDeviceVDIPort)) > -#define RED_CHAR_DEVICE_VDIPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE_VDIPORT, RedCharDeviceVDIPortClass)) > -#define RED_IS_CHAR_DEVICE_VDIPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE_VDIPORT)) > -#define RED_IS_CHAR_DEVICE_VDIPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE_VDIPORT)) > -#define RED_CHAR_DEVICE_VDIPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE_VDIPORT, RedCharDeviceVDIPortClass)) > - > -typedef struct RedCharDeviceVDIPortClass RedCharDeviceVDIPortClass; > -typedef struct RedCharDeviceVDIPortPrivate RedCharDeviceVDIPortPrivate; > - > struct RedCharDeviceVDIPort > { > RedCharDevice parent; > @@ -284,8 +276,6 @@ struct RedCharDeviceVDIPortClass > RedCharDeviceClass parent_class; > }; > > -static GType red_char_device_vdi_port_get_type(void) G_GNUC_CONST; > - > G_DEFINE_TYPE(RedCharDeviceVDIPort, red_char_device_vdi_port, RED_TYPE_CHAR_DEVICE) > > #define RED_CHAR_DEVICE_VDIPORT_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE_VDIPORT, RedCharDeviceVDIPortPrivate)) > diff --git a/server/smartcard.c b/server/smartcard.c > index 10a8b940..746b154c 100644 > --- a/server/smartcard.c > +++ b/server/smartcard.c > @@ -49,22 +49,9 @@ > // Maximal length of APDU > #define APDUBufSize 270 > > +SPICE_DECLARE_TYPE(RedSmartcardChannel, red_smartcard_channel, SMARTCARD_CHANNEL); > #define RED_TYPE_SMARTCARD_CHANNEL red_smartcard_channel_get_type() > > -#define RED_SMARTCARD_CHANNEL(obj) \ > - (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannel)) > -#define RED_SMARTCARD_CHANNEL_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelClass)) > -#define RED_IS_SMARTCARD_CHANNEL(obj) \ > - (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_SMARTCARD_CHANNEL)) > -#define RED_IS_SMARTCARD_CHANNEL_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_SMARTCARD_CHANNEL)) > -#define RED_SMARTCARD_CHANNEL_GET_CLASS(obj) \ > - (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_SMARTCARD_CHANNEL, RedSmartcardChannelClass)) > - > -typedef struct RedSmartcardChannel RedSmartcardChannel; > -typedef struct RedSmartcardChannelClass RedSmartcardChannelClass; > - > struct RedSmartcardChannel > { > RedChannel parent; > @@ -75,8 +62,6 @@ struct RedSmartcardChannelClass > RedChannelClass parent_class; > }; > > -GType red_smartcard_channel_get_type(void) G_GNUC_CONST; > - > G_DEFINE_TYPE(RedSmartcardChannel, red_smartcard_channel, RED_TYPE_CHANNEL) > > static void > diff --git a/server/smartcard.h b/server/smartcard.h > index 11d334f1..f0b4fa44 100644 > --- a/server/smartcard.h > +++ b/server/smartcard.h > @@ -24,17 +24,9 @@ > #include "char-device.h" > #include "red-channel-client.h" > > +SPICE_DECLARE_TYPE(RedCharDeviceSmartcard, red_char_device_smartcard, CHAR_DEVICE_SMARTCARD); > #define RED_TYPE_CHAR_DEVICE_SMARTCARD red_char_device_smartcard_get_type() > > -#define RED_CHAR_DEVICE_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcard)) > -#define RED_CHAR_DEVICE_SMARTCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcardClass)) > -#define RED_IS_CHAR_DEVICE_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD)) > -#define RED_IS_CHAR_DEVICE_SMARTCARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE_SMARTCARD)) > -#define RED_CHAR_DEVICE_SMARTCARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcardClass)) > - > -typedef struct RedCharDeviceSmartcard RedCharDeviceSmartcard; > -typedef struct RedCharDeviceSmartcardClass RedCharDeviceSmartcardClass; > -typedef struct RedCharDeviceSmartcardPrivate RedCharDeviceSmartcardPrivate; > typedef struct SmartCardChannelClient SmartCardChannelClient; > > struct RedCharDeviceSmartcard > @@ -49,8 +41,6 @@ struct RedCharDeviceSmartcardClass > RedCharDeviceClass parent_class; > }; > > -GType red_char_device_smartcard_get_type(void) G_GNUC_CONST; > - > /* > * connect to smartcard interface, used by smartcard channel > */ > diff --git a/server/spicevmc.c b/server/spicevmc.c > index 6a6e6202..97a55ad4 100644 > --- a/server/spicevmc.c > +++ b/server/spicevmc.c > @@ -44,8 +44,23 @@ > #define BUF_SIZE (64 * 1024 + 32) > #define COMPRESS_THRESHOLD 1000 > > -typedef struct RedVmcChannel RedVmcChannel; > -typedef struct RedVmcChannelClass RedVmcChannelClass; > +SPICE_DECLARE_TYPE(RedCharDeviceSpiceVmc, red_char_device_spicevmc, CHAR_DEVICE_SPICEVMC); > +#define RED_TYPE_CHAR_DEVICE_SPICEVMC red_char_device_spicevmc_get_type() > + > +SPICE_DECLARE_TYPE(RedVmcChannel, red_vmc_channel, VMC_CHANNEL); > +#define RED_TYPE_VMC_CHANNEL red_vmc_channel_get_type() > + > +SPICE_DECLARE_TYPE(RedVmcChannelPort, red_vmc_channel_port, VMC_CHANNEL_PORT); > +#define RED_TYPE_VMC_CHANNEL_PORT red_vmc_channel_port_get_type() > + > +SPICE_DECLARE_TYPE(VmcChannelClient, vmc_channel_client, VMC_CHANNEL_CLIENT); > +#define TYPE_VMC_CHANNEL_CLIENT vmc_channel_client_get_type() > + > +SPICE_DECLARE_TYPE(RedVmcChannelUsbredir, red_vmc_channel_usbredir, VMC_CHANNEL_USBREDIR); > +#define RED_TYPE_VMC_CHANNEL_USBREDIR red_vmc_channel_usbredir_get_type() > + > +SPICE_DECLARE_TYPE(RedVmcChannelWebdav, red_vmc_channel_webdav, VMC_CHANNEL_WEBDAV); > +#define RED_TYPE_VMC_CHANNEL_WEBDAV red_vmc_channel_webdav_get_type() > > typedef struct RedVmcPipeItem { > RedPipeItem base; > @@ -57,22 +72,6 @@ typedef struct RedVmcPipeItem { > uint32_t buf_used; > } RedVmcPipeItem; > > -#define RED_TYPE_CHAR_DEVICE_SPICEVMC red_char_device_spicevmc_get_type() > - > -#define RED_CHAR_DEVICE_SPICEVMC(obj) \ > - (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmc)) > -#define RED_CHAR_DEVICE_SPICEVMC_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcClass)) > -#define RED_IS_CHAR_DEVICE_SPICEVMC(obj) \ > - (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC)) > -#define RED_IS_CHAR_DEVICE_SPICEVMC_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE_SPICEVMC)) > -#define RED_CHAR_DEVICE_SPICEVMC_GET_CLASS(obj) \ > - (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE_SPICEVMC, RedCharDeviceSpiceVmcClass)) > - > -typedef struct RedCharDeviceSpiceVmc RedCharDeviceSpiceVmc; > -typedef struct RedCharDeviceSpiceVmcClass RedCharDeviceSpiceVmcClass; > - > struct RedCharDeviceSpiceVmc { > RedCharDevice parent; > RedVmcChannel *channel; > @@ -83,24 +82,12 @@ struct RedCharDeviceSpiceVmcClass > RedCharDeviceClass parent_class; > }; > > -static GType red_char_device_spicevmc_get_type(void) G_GNUC_CONST; > static RedCharDevice *red_char_device_spicevmc_new(SpiceCharDeviceInstance *sin, > RedsState *reds, > RedVmcChannel *channel); > > G_DEFINE_TYPE(RedCharDeviceSpiceVmc, red_char_device_spicevmc, RED_TYPE_CHAR_DEVICE) > > -#define RED_TYPE_VMC_CHANNEL red_vmc_channel_get_type() > - > -#define RED_VMC_CHANNEL(obj) \ > - (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_VMC_CHANNEL, RedVmcChannel)) > -#define RED_VMC_CHANNEL_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_CAST((klass), RED_TYPE_VMC_CHANNEL, RedVmcChannelClass)) > -#define RED_IS_VMC_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RED_TYPE_VMC_CHANNEL)) > -#define RED_IS_VMC_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_VMC_CHANNEL)) > -#define RED_VMC_CHANNEL_GET_CLASS(obj) \ > - (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_VMC_CHANNEL, RedVmcChannelClass)) > - > struct RedVmcChannel > { > RedChannel parent; > @@ -124,81 +111,56 @@ struct RedVmcChannelClass > RedChannelClass parent_class; > }; > > -GType red_vmc_channel_get_type(void) G_GNUC_CONST; > - > G_DEFINE_TYPE(RedVmcChannel, red_vmc_channel, RED_TYPE_CHANNEL) > > -#define RED_TYPE_VMC_CHANNEL_USBREDIR red_vmc_channel_usbredir_get_type() > -typedef struct > +struct RedVmcChannelUsbredir > { > RedVmcChannel parent; > -} RedVmcChannelUsbredir; > +}; > > -typedef struct > +struct RedVmcChannelUsbredirClass > { > RedVmcChannelClass parent_class; > -} RedVmcChannelUsbredirClass; > +}; > > -GType red_vmc_channel_usbredir_get_type(void) G_GNUC_CONST; > static void red_vmc_channel_usbredir_init(RedVmcChannelUsbredir *self) > { > } > G_DEFINE_TYPE(RedVmcChannelUsbredir, red_vmc_channel_usbredir, RED_TYPE_VMC_CHANNEL) > > > -#define RED_TYPE_VMC_CHANNEL_WEBDAV red_vmc_channel_webdav_get_type() > -typedef struct > +struct RedVmcChannelWebdav > { > RedVmcChannel parent; > -} RedVmcChannelWebdav; > +}; > > -typedef struct > +struct RedVmcChannelWebdavClass > { > RedVmcChannelClass parent_class; > -} RedVmcChannelWebdavClass; > +}; > > -GType red_vmc_channel_webdav_get_type(void) G_GNUC_CONST; > static void red_vmc_channel_webdav_init(RedVmcChannelWebdav *self) > { > } > G_DEFINE_TYPE(RedVmcChannelWebdav, red_vmc_channel_webdav, RED_TYPE_VMC_CHANNEL) > > > -#define RED_TYPE_VMC_CHANNEL_PORT red_vmc_channel_port_get_type() > -typedef struct > +struct RedVmcChannelPort > { > RedVmcChannel parent; > -} RedVmcChannelPort; > +}; > > -typedef struct > +struct RedVmcChannelPortClass > { > RedVmcChannelClass parent_class; > -} RedVmcChannelPortClass; > +}; > > -GType red_vmc_channel_port_get_type(void) G_GNUC_CONST; > static void red_vmc_channel_port_init(RedVmcChannelPort *self) > { > } > G_DEFINE_TYPE(RedVmcChannelPort, red_vmc_channel_port, RED_TYPE_VMC_CHANNEL) > > > -#define TYPE_VMC_CHANNEL_CLIENT vmc_channel_client_get_type() > - > -#define VMC_CHANNEL_CLIENT(obj) \ > - (G_TYPE_CHECK_INSTANCE_CAST((obj), TYPE_VMC_CHANNEL_CLIENT, VmcChannelClient)) > -#define VMC_CHANNEL_CLIENT_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_CAST((klass), TYPE_VMC_CHANNEL_CLIENT, VmcChannelClientClass)) > -#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT(obj) \ > - (G_TYPE_CHECK_INSTANCE_TYPE((obj), TYPE_VMC_CHANNEL_CLIENT)) > -#define COMMON_IS_GRAPHICS_CHANNEL_CLIENT_CLASS(klass) \ > - (G_TYPE_CHECK_CLASS_TYPE((klass), TYPE_VMC_CHANNEL_CLIENT)) > -#define VMC_CHANNEL_CLIENT_GET_CLASS(obj) \ > - (G_TYPE_INSTANCE_GET_CLASS((obj), TYPE_VMC_CHANNEL_CLIENT, VmcChannelClientClass)) > - > -typedef struct VmcChannelClient VmcChannelClient; > -typedef struct VmcChannelClientClass VmcChannelClientClass; > -typedef struct VmcChannelClientPrivate VmcChannelClientPrivate; > - > struct VmcChannelClient { > RedChannelClient parent; > }; > @@ -207,8 +169,6 @@ struct VmcChannelClientClass { > RedChannelClientClass parent_class; > }; > > -GType vmc_channel_client_get_type(void) G_GNUC_CONST; > - > G_DEFINE_TYPE(VmcChannelClient, vmc_channel_client, RED_TYPE_CHANNEL_CLIENT) > > static RedChannelClient * > -- > 2.14.3 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/spice-devel
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel