[Spice-devel] [PATCH spice-server 6/6] main-dispatcher: Avoid type conversion in dispatcher_handle_read

Christophe Fergeau cfergeau at redhat.com
Thu Sep 7 14:50:52 UTC 2017


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Thu, Sep 07, 2017 at 12:40:26PM +0100, Frediano Ziglio wrote:
> Pass proper type to callback to avoid having to convert to
> the right type for each call.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> This make dispatcher_handle_read identical to handle_dev_input.
> ---
>  server/main-dispatcher.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/server/main-dispatcher.c b/server/main-dispatcher.c
> index 019bf4d3f..71f8f65d9 100644
> --- a/server/main-dispatcher.c
> +++ b/server/main-dispatcher.c
> @@ -280,9 +280,9 @@ void main_dispatcher_client_disconnect(MainDispatcher *self, RedClient *client)
>  
>  static void dispatcher_handle_read(int fd, int event, void *opaque)
>  {
> -    MainDispatcher *self = opaque;
> +    Dispatcher *dispatcher = opaque;
>  
> -    dispatcher_handle_recv_read(DISPATCHER(self));
> +    dispatcher_handle_recv_read(dispatcher);
>  }
>  
>  /*
> @@ -311,7 +311,7 @@ void main_dispatcher_constructed(GObject *object)
>          self->priv->core->watch_add(self->priv->core,
>                                      dispatcher_get_recv_fd(DISPATCHER(self)),
>                                      SPICE_WATCH_EVENT_READ, dispatcher_handle_read,
> -                                    self);
> +                                    DISPATCHER(self));
>      dispatcher_register_handler(DISPATCHER(self), MAIN_DISPATCHER_CHANNEL_EVENT,
>                                  main_dispatcher_handle_channel_event,
>                                  sizeof(MainDispatcherChannelEventMessage), 0 /* no ack */);
> -- 
> 2.13.5
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list