[spice-server v2 10/14] rcc: Replace 'opaque' arg with typed RedChannelClient

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The methods previously used by OutgoingHandlerInterface and
IncomingHandlerInterface are no longer used as generic callbacks,
but are directly called from RedChannelClient code. We can be explicit
about the type of their first argument (RedChannelClient *) rather than
using a generic void * pointer.

Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
 server/red-channel-client.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 8b2434c..d33e756 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -368,9 +368,8 @@ RedChannel* red_channel_client_get_channel(RedChannelClient *rcc)
     return rcc->priv->channel;
 }
 
-static void red_channel_client_data_sent(void *opaque, int n)
+static void red_channel_client_data_sent(RedChannelClient *rcc, int n)
 {
-    RedChannelClient *rcc = opaque;
     RedChannel *channel = red_channel_client_get_channel(rcc);
 
     if (rcc->priv->connectivity_monitor.timer) {
@@ -380,35 +379,29 @@ static void red_channel_client_data_sent(void *opaque, int n)
     red_channel_on_output(channel, n);
 }
 
-static void red_channel_client_data_read(void *opaque, int n)
+static void red_channel_client_data_read(RedChannelClient *rcc, int n)
 {
-    RedChannelClient *rcc = opaque;
-
     if (rcc->priv->connectivity_monitor.timer) {
         rcc->priv->connectivity_monitor.in_bytes += n;
     }
 }
 
-static int red_channel_client_get_out_msg_size(void *opaque)
+static int red_channel_client_get_out_msg_size(RedChannelClient *rcc)
 {
-    RedChannelClient *rcc = RED_CHANNEL_CLIENT(opaque);
-
     return rcc->priv->send_data.size;
 }
 
-static void red_channel_client_prepare_out_msg(void *opaque, struct iovec *vec,
-                                               int *vec_size, int pos)
+static void red_channel_client_prepare_out_msg(RedChannelClient *rcc,
+                                               struct iovec *vec, int *vec_size,
+                                               int pos)
 {
-    RedChannelClient *rcc = RED_CHANNEL_CLIENT(opaque);
-
     *vec_size = spice_marshaller_fill_iovec(rcc->priv->send_data.marshaller,
                                             vec, IOV_MAX, pos);
 }
 
-static void red_channel_client_set_blocked(void *opaque)
+static void red_channel_client_set_blocked(RedChannelClient *rcc)
 {
     SpiceCoreInterfaceInternal *core;
-    RedChannelClient *rcc = RED_CHANNEL_CLIENT(opaque);
 
     rcc->priv->send_data.blocked = TRUE;
     core = red_channel_get_core_interface(rcc->priv->channel);
@@ -545,9 +538,8 @@ static void red_channel_client_restore_main_sender(RedChannelClient *rcc)
     rcc->priv->send_data.header.data = rcc->priv->send_data.main.header_data;
 }
 
-static void red_channel_client_msg_sent(void *opaque)
+static void red_channel_client_msg_sent(RedChannelClient *rcc)
 {
-    RedChannelClient *rcc = RED_CHANNEL_CLIENT(opaque);
     int fd;
 
     if (spice_marshaller_get_fd(rcc->priv->send_data.marshaller, &fd)) {
-- 
2.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]