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

Frediano Ziglio fziglio at redhat.com
Thu Sep 7 11:40:26 UTC 2017


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



More information about the Spice-devel mailing list