Use TYPE_get_instance_private instead which was introduced in GLib 2.38. G_TYPE_INSTANCE_GET_PRIVATE will be deprecated in GLib 2.58. Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- server/char-device.c | 4 +--- server/common-graphics-channel.c | 11 ++--------- server/cursor-channel-client.c | 5 +---- server/dispatcher.c | 4 +--- server/inputs-channel-client.c | 5 +---- server/main-channel-client.c | 5 +---- server/main-dispatcher.c | 4 +--- server/red-channel-client.c | 5 +---- server/red-channel.c | 4 +--- server/reds.c | 4 +--- server/smartcard-channel-client.c | 6 +----- server/smartcard.c | 6 +----- 12 files changed, 13 insertions(+), 50 deletions(-) Follow up for "Use new GObject define macros with private". Edurdo, maybe you can squash this with the "Use new GObject define macros with private" patch. diff --git a/server/char-device.c b/server/char-device.c index cda26be8..f58402cc 100644 --- a/server/char-device.c +++ b/server/char-device.c @@ -86,8 +86,6 @@ struct RedCharDevicePrivate { G_DEFINE_TYPE_WITH_PRIVATE(RedCharDevice, red_char_device, G_TYPE_OBJECT) -#define RED_CHAR_DEVICE_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE, RedCharDevicePrivate)) - enum { PROP_0, PROP_CHAR_DEV_INSTANCE, @@ -1178,7 +1176,7 @@ SPICE_GNUC_VISIBLE void spice_server_port_event(SpiceCharDeviceInstance *sin, ui static void red_char_device_init(RedCharDevice *self) { - self->priv = RED_CHAR_DEVICE_PRIVATE(self); + self->priv = red_char_device_get_instance_private(self); g_queue_init(&self->priv->write_queue); g_queue_init(&self->priv->write_bufs_pool); diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c index 3d76c82c..1bf44fee 100644 --- a/server/common-graphics-channel.c +++ b/server/common-graphics-channel.c @@ -37,19 +37,12 @@ struct CommonGraphicsChannelPrivate G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(CommonGraphicsChannel, common_graphics_channel, RED_TYPE_CHANNEL) -#define GRAPHICS_CHANNEL_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelPrivate)) - struct CommonGraphicsChannelClientPrivate { uint8_t recv_buf[CHANNEL_RECEIVE_BUF_SIZE]; }; G_DEFINE_TYPE_WITH_PRIVATE(CommonGraphicsChannelClient, common_graphics_channel_client, RED_TYPE_CHANNEL_CLIENT) -#define GRAPHICS_CHANNEL_CLIENT_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \ - CommonGraphicsChannelClientPrivate)) - static uint8_t *common_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint32_t size) { CommonGraphicsChannelClient *common = COMMON_GRAPHICS_CHANNEL_CLIENT(rcc); @@ -108,7 +101,7 @@ common_graphics_channel_class_init(CommonGraphicsChannelClass *klass) static void common_graphics_channel_init(CommonGraphicsChannel *self) { - self->priv = GRAPHICS_CHANNEL_PRIVATE(self); + self->priv = common_graphics_channel_get_instance_private(self); } void common_graphics_channel_set_during_target_migrate(CommonGraphicsChannel *self, gboolean value) @@ -124,7 +117,7 @@ gboolean common_graphics_channel_get_during_target_migrate(CommonGraphicsChannel static void common_graphics_channel_client_init(CommonGraphicsChannelClient *self) { - self->priv = GRAPHICS_CHANNEL_CLIENT_PRIVATE(self); + self->priv = common_graphics_channel_client_get_instance_private(self); } static void diff --git a/server/cursor-channel-client.c b/server/cursor-channel-client.c index 8b50a3ab..dfe1b13d 100644 --- a/server/cursor-channel-client.c +++ b/server/cursor-channel-client.c @@ -45,9 +45,6 @@ struct CursorChannelClientPrivate G_DEFINE_TYPE_WITH_PRIVATE(CursorChannelClient, cursor_channel_client, TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT) -#define CURSOR_CHANNEL_CLIENT_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_CURSOR_CHANNEL_CLIENT, CursorChannelClientPrivate)) - static void cursor_channel_client_on_disconnect(RedChannelClient *rcc); static void @@ -61,7 +58,7 @@ cursor_channel_client_class_init(CursorChannelClientClass *klass) static void cursor_channel_client_init(CursorChannelClient *self) { - self->priv = CURSOR_CHANNEL_CLIENT_PRIVATE(self); + self->priv = cursor_channel_client_get_instance_private(self); ring_init(&self->priv->cursor_cache_lru); self->priv->cursor_cache_available = CLIENT_CURSOR_CACHE_SIZE; } diff --git a/server/dispatcher.c b/server/dispatcher.c index 21bd0ebe..c598ed7f 100644 --- a/server/dispatcher.c +++ b/server/dispatcher.c @@ -60,8 +60,6 @@ struct DispatcherPrivate { G_DEFINE_TYPE_WITH_PRIVATE(Dispatcher, dispatcher, G_TYPE_OBJECT) -#define DISPATCHER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DISPATCHER, DispatcherPrivate)) - enum { PROP_0, PROP_MAX_MESSAGE_TYPE @@ -162,7 +160,7 @@ dispatcher_class_init(DispatcherClass *klass) static void dispatcher_init(Dispatcher *self) { - self->priv = DISPATCHER_PRIVATE(self); + self->priv = dispatcher_get_instance_private(self); } Dispatcher * diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c index bba4692f..61254c7e 100644 --- a/server/inputs-channel-client.c +++ b/server/inputs-channel-client.c @@ -41,9 +41,6 @@ struct InputsChannelClientPrivate G_DEFINE_TYPE_WITH_PRIVATE(InputsChannelClient, inputs_channel_client, RED_TYPE_CHANNEL_CLIENT) -#define INPUTS_CHANNEL_CLIENT_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_INPUTS_CHANNEL_CLIENT, InputsChannelClientPrivate)) - static uint8_t * inputs_channel_client_alloc_msg_rcv_buf(RedChannelClient *rcc, uint16_t type, uint32_t size) @@ -85,7 +82,7 @@ inputs_channel_client_class_init(InputsChannelClientClass *klass) static void inputs_channel_client_init(InputsChannelClient *self) { - self->priv = INPUTS_CHANNEL_CLIENT_PRIVATE(self); + self->priv = inputs_channel_client_get_instance_private(self); } RedChannelClient* inputs_channel_client_create(RedChannel *channel, diff --git a/server/main-channel-client.c b/server/main-channel-client.c index 3458ccad..3c18bb9d 100644 --- a/server/main-channel-client.c +++ b/server/main-channel-client.c @@ -63,9 +63,6 @@ struct MainChannelClientPrivate { G_DEFINE_TYPE_WITH_PRIVATE(MainChannelClient, main_channel_client, RED_TYPE_CHANNEL_CLIENT) -#define MAIN_CHANNEL_CLIENT_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_MAIN_CHANNEL_CLIENT, MainChannelClientPrivate)) - typedef struct RedPingPipeItem { RedPipeItem base; int size; @@ -233,7 +230,7 @@ static void main_channel_client_class_init(MainChannelClientClass *klass) static void main_channel_client_init(MainChannelClient *self) { - self->priv = MAIN_CHANNEL_CLIENT_PRIVATE(self); + self->priv = main_channel_client_get_instance_private(self); self->priv->bitrate_per_sec = ~0; } diff --git a/server/main-dispatcher.c b/server/main-dispatcher.c index 0eab9d74..99d2a621 100644 --- a/server/main-dispatcher.c +++ b/server/main-dispatcher.c @@ -55,8 +55,6 @@ struct MainDispatcherPrivate G_DEFINE_TYPE_WITH_PRIVATE(MainDispatcher, main_dispatcher, TYPE_DISPATCHER) -#define MAIN_DISPATCHER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_MAIN_DISPATCHER, MainDispatcherPrivate)) - enum { PROP0, PROP_SPICE_SERVER, @@ -136,7 +134,7 @@ main_dispatcher_class_init(MainDispatcherClass *klass) static void main_dispatcher_init(MainDispatcher *self) { - self->priv = MAIN_DISPATCHER_PRIVATE(self); + self->priv = main_dispatcher_get_instance_private(self); } enum { diff --git a/server/red-channel-client.c b/server/red-channel-client.c index 459aecfa..9aa76792 100644 --- a/server/red-channel-client.c +++ b/server/red-channel-client.c @@ -190,9 +190,6 @@ G_DEFINE_TYPE_WITH_CODE(RedChannelClient, red_channel_client, G_TYPE_OBJECT, red_channel_client_initable_interface_init); G_ADD_PRIVATE(RedChannelClient)); -#define CHANNEL_CLIENT_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), RED_TYPE_CHANNEL_CLIENT, RedChannelClientPrivate)) - static gboolean red_channel_client_initable_init(GInitable *initable, GCancellable *cancellable, GError **error); @@ -454,7 +451,7 @@ static void red_channel_client_class_init(RedChannelClientClass *klass) static void red_channel_client_init(RedChannelClient *self) { - self->priv = CHANNEL_CLIENT_PRIVATE(self); + self->priv = red_channel_client_get_instance_private(self); // blocks send message (maybe use send_data.blocked + block flags) self->priv->ack_data.messages_window = ~0; self->priv->ack_data.client_generation = ~0; diff --git a/server/red-channel.c b/server/red-channel.c index deaeefad..a58f757c 100644 --- a/server/red-channel.c +++ b/server/red-channel.c @@ -96,8 +96,6 @@ struct RedChannelPrivate G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(RedChannel, red_channel, G_TYPE_OBJECT) -#define CHANNEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), RED_TYPE_CHANNEL, RedChannelPrivate)) - enum { PROP0, PROP_SPICE_SERVER, @@ -286,7 +284,7 @@ red_channel_class_init(RedChannelClass *klass) static void red_channel_init(RedChannel *self) { - self->priv = CHANNEL_PRIVATE(self); + self->priv = red_channel_get_instance_private(self); red_channel_set_common_cap(self, SPICE_COMMON_CAP_MINI_HEADER); self->priv->thread_id = pthread_self(); diff --git a/server/reds.c b/server/reds.c index 89d03b8f..92114d1e 100644 --- a/server/reds.c +++ b/server/reds.c @@ -283,8 +283,6 @@ struct RedCharDeviceVDIPortClass G_DEFINE_TYPE_WITH_PRIVATE(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)) - static RedCharDeviceVDIPort *red_char_device_vdi_port_new(RedsState *reds); static void migrate_timeout(void *opaque); @@ -4591,7 +4589,7 @@ static void red_char_device_vdi_port_constructed(GObject *object) static void red_char_device_vdi_port_init(RedCharDeviceVDIPort *self) { - self->priv = RED_CHAR_DEVICE_VDIPORT_PRIVATE(self); + self->priv = red_char_device_vdi_port_get_instance_private(self); self->priv->read_state = VDI_PORT_READ_STATE_READ_HEADER; self->priv->receive_pos = (uint8_t *)&self->priv->vdi_chunk_header; diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c index 49e765b7..a665e933 100644 --- a/server/smartcard-channel-client.c +++ b/server/smartcard-channel-client.c @@ -22,10 +22,6 @@ G_DEFINE_TYPE(SmartCardChannelClient, smart_card_channel_client, RED_TYPE_CHANNEL_CLIENT) -#define SMARTCARD_CHANNEL_CLIENT_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_SMARTCARD_CHANNEL_CLIENT, \ - SmartCardChannelClientPrivate)) - struct SmartCardChannelClientPrivate { RedCharDeviceSmartcard *smartcard; @@ -103,7 +99,7 @@ static void smart_card_channel_client_class_init(SmartCardChannelClientClass *kl static void smart_card_channel_client_init(SmartCardChannelClient *self) { - self->priv = SMARTCARD_CHANNEL_CLIENT_PRIVATE(self); + self->priv = smart_card_channel_client_get_instance_private(self); } SmartCardChannelClient* smartcard_channel_client_create(RedChannel *channel, diff --git a/server/smartcard.c b/server/smartcard.c index 387c71a9..504d6f03 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -97,10 +97,6 @@ struct RedCharDeviceSmartcardPrivate { G_DEFINE_TYPE_WITH_PRIVATE(RedCharDeviceSmartcard, red_char_device_smartcard, RED_TYPE_CHAR_DEVICE) -#define RED_CHAR_DEVICE_SMARTCARD_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE_SMARTCARD, \ - RedCharDeviceSmartcardPrivate)) - typedef struct RedMsgItem { RedPipeItem base; @@ -619,7 +615,7 @@ red_char_device_smartcard_class_init(RedCharDeviceSmartcardClass *klass) static void red_char_device_smartcard_init(RedCharDeviceSmartcard *self) { - self->priv = RED_CHAR_DEVICE_SMARTCARD_PRIVATE(self); + self->priv = red_char_device_smartcard_get_instance_private(self); self->priv->reader_id = VSCARD_UNDEFINED_READER_ID; self->priv->buf_size = APDUBufSize + sizeof(VSCMsgHeader); -- 2.20.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel