G_ADD_PRIVATE was added in 2.38 and older functions are getting deprecated: https://gitlab.gnome.org/GNOME/glib/merge_requests/7/commits Signed-off-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx> --- server/char-device.c | 4 +--- server/common-graphics-channel.c | 23 ++++++++++------------- server/cursor-channel-client.c | 12 +++++------- server/dispatcher.c | 11 ++++------- server/inputs-channel-client.c | 12 +++++------- server/main-channel-client.c | 12 +++++------- server/main-dispatcher.c | 10 +++------- server/red-channel-client.c | 4 ++-- server/red-channel.c | 11 ++++------- server/reds.c | 4 +--- server/smartcard.c | 15 ++++++--------- 11 files changed, 46 insertions(+), 72 deletions(-) diff --git a/server/char-device.c b/server/char-device.c index 64b41a94..cda26be8 100644 --- a/server/char-device.c +++ b/server/char-device.c @@ -84,7 +84,7 @@ struct RedCharDevicePrivate { SpiceServer *reds; }; -G_DEFINE_TYPE(RedCharDevice, red_char_device, G_TYPE_OBJECT) +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)) @@ -1119,8 +1119,6 @@ red_char_device_class_init(RedCharDeviceClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); - g_type_class_add_private(klass, sizeof (RedCharDevicePrivate)); - object_class->get_property = red_char_device_get_property; object_class->set_property = red_char_device_set_property; object_class->finalize = red_char_device_finalize; diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c index 083ab3eb..3d76c82c 100644 --- a/server/common-graphics-channel.c +++ b/server/common-graphics-channel.c @@ -26,16 +26,6 @@ #define CHANNEL_RECEIVE_BUF_SIZE 1024 -G_DEFINE_ABSTRACT_TYPE(CommonGraphicsChannel, common_graphics_channel, RED_TYPE_CHANNEL) - -G_DEFINE_TYPE(CommonGraphicsChannelClient, common_graphics_channel_client, RED_TYPE_CHANNEL_CLIENT) - -#define GRAPHICS_CHANNEL_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_COMMON_GRAPHICS_CHANNEL, CommonGraphicsChannelPrivate)) -#define GRAPHICS_CHANNEL_CLIENT_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_COMMON_GRAPHICS_CHANNEL_CLIENT, \ - CommonGraphicsChannelClientPrivate)) - struct CommonGraphicsChannelPrivate { int during_target_migrate; /* TRUE when the client that is associated with the channel @@ -45,10 +35,20 @@ struct CommonGraphicsChannelPrivate of the primary surface) */ }; +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) { @@ -103,7 +103,6 @@ bool common_channel_client_config_socket(RedChannelClient *rcc) static void common_graphics_channel_class_init(CommonGraphicsChannelClass *klass) { - g_type_class_add_private(klass, sizeof(CommonGraphicsChannelPrivate)); } static void @@ -133,8 +132,6 @@ common_graphics_channel_client_class_init(CommonGraphicsChannelClientClass *klas { RedChannelClientClass *client_class = RED_CHANNEL_CLIENT_CLASS(klass); - g_type_class_add_private(klass, sizeof(CommonGraphicsChannelClientPrivate)); - client_class->config_socket = common_channel_client_config_socket; client_class->alloc_recv_buf = common_alloc_recv_buf; client_class->release_recv_buf = common_release_recv_buf; diff --git a/server/cursor-channel-client.c b/server/cursor-channel-client.c index 6d39e24e..8b50a3ab 100644 --- a/server/cursor-channel-client.c +++ b/server/cursor-channel-client.c @@ -35,11 +35,6 @@ #define CURSOR_CACHE_HASH_KEY(id) ((id) & CURSOR_CACHE_HASH_MASK) #define CURSOR_CLIENT_TIMEOUT 30000000000ULL //nano -G_DEFINE_TYPE(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)) - struct CursorChannelClientPrivate { RedCacheItem *cursor_cache[CURSOR_CACHE_HASH_SIZE]; @@ -48,6 +43,11 @@ struct CursorChannelClientPrivate uint32_t cursor_cache_items; }; +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 @@ -55,8 +55,6 @@ cursor_channel_client_class_init(CursorChannelClientClass *klass) { RedChannelClientClass *client_class = RED_CHANNEL_CLIENT_CLASS(klass); - g_type_class_add_private(klass, sizeof(CursorChannelClientPrivate)); - client_class->on_disconnect = cursor_channel_client_on_disconnect; } diff --git a/server/dispatcher.c b/server/dispatcher.c index 3e27f2c2..21bd0ebe 100644 --- a/server/dispatcher.c +++ b/server/dispatcher.c @@ -44,11 +44,6 @@ typedef struct DispatcherMessage { dispatcher_handle_message handler; } DispatcherMessage; - -G_DEFINE_TYPE(Dispatcher, dispatcher, G_TYPE_OBJECT) - -#define DISPATCHER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DISPATCHER, DispatcherPrivate)) - struct DispatcherPrivate { int recv_fd; int send_fd; @@ -63,6 +58,10 @@ struct DispatcherPrivate { dispatcher_handle_any_message any_handler; }; +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 @@ -144,8 +143,6 @@ dispatcher_class_init(DispatcherClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); - g_type_class_add_private(klass, sizeof (DispatcherPrivate)); - object_class->get_property = dispatcher_get_property; object_class->set_property = dispatcher_set_property; object_class->constructed = dispatcher_constructed; diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c index 5fd818a1..bba4692f 100644 --- a/server/inputs-channel-client.c +++ b/server/inputs-channel-client.c @@ -22,11 +22,6 @@ #include "migration-protocol.h" #include "red-channel-client.h" -G_DEFINE_TYPE(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)) - // TODO: RECEIVE_BUF_SIZE used to be the same for inputs_channel and main_channel // since it was defined once in reds.c which contained both. // Now that they are split we can give a more fitting value for inputs - what @@ -44,6 +39,11 @@ struct InputsChannelClientPrivate uint8_t recv_buf[RECEIVE_BUF_SIZE]; }; +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) @@ -77,8 +77,6 @@ inputs_channel_client_class_init(InputsChannelClientClass *klass) { RedChannelClientClass *client_class = RED_CHANNEL_CLIENT_CLASS(klass); - g_type_class_add_private(klass, sizeof(InputsChannelClientPrivate)); - client_class->alloc_recv_buf = inputs_channel_client_alloc_msg_rcv_buf; client_class->release_recv_buf = inputs_channel_client_release_msg_rcv_buf; client_class->on_disconnect = inputs_channel_client_on_disconnect; diff --git a/server/main-channel-client.c b/server/main-channel-client.c index 54be9934..3458ccad 100644 --- a/server/main-channel-client.c +++ b/server/main-channel-client.c @@ -40,11 +40,6 @@ typedef enum { #define CLIENT_CONNECTIVITY_TIMEOUT (MSEC_PER_SEC * 30) -G_DEFINE_TYPE(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)) - // approximate max receive message size for main channel #define MAIN_CHANNEL_RECEIVE_BUF_SIZE \ (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE) @@ -66,6 +61,11 @@ struct MainChannelClientPrivate { uint8_t recv_buf[MAIN_CHANNEL_RECEIVE_BUF_SIZE]; }; +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; @@ -211,8 +211,6 @@ static void main_channel_client_class_init(MainChannelClientClass *klass) GObjectClass *object_class = G_OBJECT_CLASS(klass); RedChannelClientClass *client_class = RED_CHANNEL_CLIENT_CLASS(klass); - g_type_class_add_private(klass, sizeof(MainChannelClientPrivate)); - object_class->get_property = main_channel_client_get_property; object_class->set_property = main_channel_client_set_property; diff --git a/server/main-dispatcher.c b/server/main-dispatcher.c index 43f8b79a..0eab9d74 100644 --- a/server/main-dispatcher.c +++ b/server/main-dispatcher.c @@ -46,11 +46,6 @@ * main_dispatcher_handle_<event_name> - handler for callback from main thread * seperate from self because it may send an ack or do other work in the future. */ - -G_DEFINE_TYPE(MainDispatcher, main_dispatcher, TYPE_DISPATCHER) - -#define MAIN_DISPATCHER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_MAIN_DISPATCHER, MainDispatcherPrivate)) - struct MainDispatcherPrivate { SpiceCoreInterfaceInternal *core; /* weak */ @@ -58,6 +53,9 @@ struct MainDispatcherPrivate SpiceWatch *watch; }; +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, @@ -113,8 +111,6 @@ main_dispatcher_class_init(MainDispatcherClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); - g_type_class_add_private(klass, sizeof(MainDispatcherPrivate)); - object_class->constructed = main_dispatcher_constructed; object_class->finalize = main_dispatcher_finalize; object_class->get_property = main_dispatcher_get_property; diff --git a/server/red-channel-client.c b/server/red-channel-client.c index 375a60b3..459aecfa 100644 --- a/server/red-channel-client.c +++ b/server/red-channel-client.c @@ -187,7 +187,8 @@ static bool red_channel_client_config_socket(RedChannelClient *rcc); G_DEFINE_TYPE_WITH_CODE(RedChannelClient, red_channel_client, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(G_TYPE_INITABLE, - red_channel_client_initable_interface_init)) + 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)) @@ -404,7 +405,6 @@ static void red_channel_client_class_init(RedChannelClientClass *klass) GParamSpec *spec; g_debug("%s", G_STRFUNC); - g_type_class_add_private(klass, sizeof(RedChannelClientPrivate)); object_class->get_property = red_channel_client_get_property; object_class->set_property = red_channel_client_set_property; diff --git a/server/red-channel.c b/server/red-channel.c index 448b690e..deaeefad 100644 --- a/server/red-channel.c +++ b/server/red-channel.c @@ -65,11 +65,6 @@ * If a call to red_channel_client_destroy is made from another location, it must be called * from the channel's thread. */ - -G_DEFINE_ABSTRACT_TYPE(RedChannel, red_channel, G_TYPE_OBJECT) - -#define CHANNEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), RED_TYPE_CHANNEL, RedChannelPrivate)) - struct RedChannelPrivate { uint32_t type; @@ -99,6 +94,10 @@ struct RedChannelPrivate RedStatNode stat; }; +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, @@ -219,8 +218,6 @@ red_channel_class_init(RedChannelClass *klass) GParamSpec *spec; GObjectClass *object_class = G_OBJECT_CLASS(klass); - g_type_class_add_private(klass, sizeof (RedChannelPrivate)); - object_class->get_property = red_channel_get_property; object_class->set_property = red_channel_set_property; object_class->finalize = red_channel_finalize; diff --git a/server/reds.c b/server/reds.c index 24047bda..89d03b8f 100644 --- a/server/reds.c +++ b/server/reds.c @@ -281,7 +281,7 @@ struct RedCharDeviceVDIPortClass RedCharDeviceClass parent_class; }; -G_DEFINE_TYPE(RedCharDeviceVDIPort, red_char_device_vdi_port, RED_TYPE_CHAR_DEVICE) +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)) @@ -4623,8 +4623,6 @@ red_char_device_vdi_port_class_init(RedCharDeviceVDIPortClass *klass) GObjectClass *object_class = G_OBJECT_CLASS(klass); RedCharDeviceClass *char_dev_class = RED_CHAR_DEVICE_CLASS(klass); - g_type_class_add_private(klass, sizeof (RedCharDeviceVDIPortPrivate)); - object_class->finalize = red_char_device_vdi_port_finalize; object_class->constructed = red_char_device_vdi_port_constructed; diff --git a/server/smartcard.c b/server/smartcard.c index 4c849450..387c71a9 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -83,13 +83,6 @@ red_smartcard_channel_new(RedsState *reds) NULL); } - -G_DEFINE_TYPE(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)) - struct RedCharDeviceSmartcardPrivate { uint32_t reader_id; /* read_from_device buffer */ @@ -102,6 +95,12 @@ struct RedCharDeviceSmartcardPrivate { int reader_added; // has reader_add been sent to the device }; +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; @@ -609,8 +608,6 @@ red_char_device_smartcard_class_init(RedCharDeviceSmartcardClass *klass) GObjectClass *object_class = G_OBJECT_CLASS(klass); RedCharDeviceClass *char_dev_class = RED_CHAR_DEVICE_CLASS(klass); - g_type_class_add_private(klass, sizeof (RedCharDeviceSmartcardPrivate)); - object_class->finalize = red_char_device_smartcard_finalize; char_dev_class->read_one_msg_from_device = smartcard_read_msg_from_device; -- 2.20.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel