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

Jonathon Jongsma jjongsma at redhat.com
Thu Feb 9 17:45:02 UTC 2017


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>


On Tue, 2017-02-07 at 11:59 +0100, Christophe Fergeau wrote:
> 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.
> ---
>  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 c92434b..8b15364 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_on_output(void *opaque, int n)
> +static void red_channel_client_on_output(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_on_output(void
> *opaque, int n)
>      red_channel_on_output(channel, n);
>  }
>  
> -static void red_channel_client_on_input(void *opaque, int n)
> +static void red_channel_client_on_input(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_on_out_block(void *opaque)
> +static void red_channel_client_on_out_block(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_on_out_msg_done(void *opaque)
> +static void red_channel_client_on_out_msg_done(RedChannelClient
> *rcc)
>  {
> -    RedChannelClient *rcc = RED_CHANNEL_CLIENT(opaque);
>      int fd;
>  
>      if (spice_marshaller_get_fd(rcc->priv->send_data.marshaller,
> &fd)) {


More information about the Spice-devel mailing list