[PATCH spice-server 4/6] Use new red_channel_pipes_add instead of red_channel_pipes_new_add

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

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/cursor-channel.c      |  7 +++----
 server/inputs-channel.c      |  9 ++++-----
 server/main-channel-client.c | 13 +++++--------
 server/main-channel-client.h | 14 ++------------
 server/main-channel.c        | 16 +++-------------
 5 files changed, 17 insertions(+), 42 deletions(-)

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 63d6886d..294ffa66 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -110,13 +110,13 @@ static void cursor_channel_set_item(CursorChannel *cursor, CursorItem *item)
     cursor->item = item ? cursor_item_ref(item) : NULL;
 }
 
-static RedPipeItem *new_cursor_pipe_item(RedChannelClient *rcc, void *data, int num)
+static RedPipeItem *new_cursor_pipe_item(CursorItem *cursor_item)
 {
     RedCursorPipeItem *item = spice_malloc0(sizeof(RedCursorPipeItem));
 
     red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_CURSOR,
                             cursor_pipe_item_free);
-    item->cursor_item = data;
+    item->cursor_item = cursor_item;
     item->cursor_item->refs++;
     return &item->base;
 }
@@ -343,8 +343,7 @@ void cursor_channel_process_cmd(CursorChannel *cursor, RedCursorCmd *cursor_cmd)
         (cursor->mouse_mode == SPICE_MOUSE_MODE_SERVER
          || cursor_cmd->type != QXL_CURSOR_MOVE
          || cursor_show)) {
-        red_channel_pipes_new_add(RED_CHANNEL(cursor),
-                                  new_cursor_pipe_item, cursor_item);
+        red_channel_pipes_add(RED_CHANNEL(cursor), new_cursor_pipe_item(cursor_item));
     }
 
     cursor_item_unref(cursor_item);
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 943c69d6..37ee0feb 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -194,13 +194,12 @@ static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
     return sif->get_leds(sin);
 }
 
-static RedPipeItem *red_inputs_key_modifiers_item_new(
-    RedChannelClient *rcc, void *data, int num)
+static RedPipeItem *red_inputs_key_modifiers_item_new(uint8_t modifiers)
 {
     RedKeyModifiersPipeItem *item = spice_malloc(sizeof(RedKeyModifiersPipeItem));
 
     red_pipe_item_init(&item->base, RED_PIPE_ITEM_KEY_MODIFIERS);
-    item->modifiers = *(uint8_t *)data;
+    item->modifiers = modifiers;
     return &item->base;
 }
 
@@ -484,8 +483,8 @@ static void inputs_channel_push_keyboard_modifiers(InputsChannel *inputs, uint8_
         inputs->src_during_migrate) {
         return;
     }
-    red_channel_pipes_new_add_push(RED_CHANNEL(inputs),
-        red_inputs_key_modifiers_item_new, (void*)&modifiers);
+    red_channel_pipes_add(RED_CHANNEL(inputs),
+                          red_inputs_key_modifiers_item_new(modifiers));
 }
 
 void inputs_channel_on_keyboard_leds_change(InputsChannel *inputs, uint8_t leds)
diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index db8e4823..0ddb4d33 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -414,26 +414,23 @@ void main_channel_client_push_notify(MainChannelClient *mcc, const char *msg)
     red_channel_client_pipe_add_push(RED_CHANNEL_CLIENT(mcc), item);
 }
 
-RedPipeItem *main_mouse_mode_item_new(RedChannelClient *rcc, void *data, int num)
+RedPipeItem *main_mouse_mode_item_new(SpiceMouseMode current_mode, int is_client_mouse_allowed)
 {
     RedMouseModePipeItem *item = spice_malloc(sizeof(RedMouseModePipeItem));
-    MainMouseModeItemInfo *info = data;
 
     red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_MOUSE_MODE);
-    item->current_mode = info->current_mode;
-    item->is_client_mouse_allowed = info->is_client_mouse_allowed;
+    item->current_mode = current_mode;
+    item->is_client_mouse_allowed = is_client_mouse_allowed;
     return &item->base;
 }
 
-RedPipeItem *main_multi_media_time_item_new(RedChannelClient *rcc,
-                                            void *data, int num)
+RedPipeItem *main_multi_media_time_item_new(uint32_t mm_time)
 {
-    MainMultiMediaTimeItemInfo *info = data;
     RedMultiMediaTimePipeItem *item;
 
     item = spice_malloc(sizeof(RedMultiMediaTimePipeItem));
     red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME);
-    item->time = info->time;
+    item->time = mm_time;
     return &item->base;
 }
 
diff --git a/server/main-channel-client.h b/server/main-channel-client.h
index 0f8e4f49..26b7e20b 100644
--- a/server/main-channel-client.h
+++ b/server/main-channel-client.h
@@ -124,19 +124,9 @@ enum {
     RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS,
 };
 
-typedef struct MainMouseModeItemInfo {
-    SpiceMouseMode current_mode;
-    int is_client_mouse_allowed;
-} MainMouseModeItemInfo;
+RedPipeItem *main_mouse_mode_item_new(SpiceMouseMode current_mode, int is_client_mouse_allowed);
 
-RedPipeItem *main_mouse_mode_item_new(RedChannelClient *rcc, void *data, int num);
-
-typedef struct MainMultiMediaTimeItemInfo {
-    uint32_t time;
-} MainMultiMediaTimeItemInfo;
-
-RedPipeItem *main_multi_media_time_item_new(RedChannelClient *rcc,
-                                            void *data, int num);
+RedPipeItem *main_multi_media_time_item_new(uint32_t mm_time);
 
 G_END_DECLS
 
diff --git a/server/main-channel.c b/server/main-channel.c
index 186451f2..d3b90651 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -87,13 +87,8 @@ static void main_channel_push_channels(MainChannelClient *mcc)
 void main_channel_push_mouse_mode(MainChannel *main_chan, SpiceMouseMode current_mode,
                                   int is_client_mouse_allowed)
 {
-    MainMouseModeItemInfo info = {
-        .current_mode=current_mode,
-        .is_client_mouse_allowed=is_client_mouse_allowed,
-    };
-
-    red_channel_pipes_new_add(RED_CHANNEL(main_chan),
-        main_mouse_mode_item_new, &info);
+    red_channel_pipes_add(RED_CHANNEL(main_chan),
+                          main_mouse_mode_item_new(current_mode, is_client_mouse_allowed));
 }
 
 void main_channel_push_agent_connected(MainChannel *main_chan)
@@ -147,12 +142,7 @@ static bool main_channel_handle_migrate_data(RedChannelClient *rcc,
 
 void main_channel_push_multi_media_time(MainChannel *main_chan, uint32_t time)
 {
-    MainMultiMediaTimeItemInfo info = {
-        .time = time,
-    };
-
-    red_channel_pipes_new_add(RED_CHANNEL(main_chan),
-        main_multi_media_time_item_new, &info);
+    red_channel_pipes_add(RED_CHANNEL(main_chan), main_multi_media_time_item_new(time));
 }
 
 static void main_channel_fill_mig_target(MainChannel *main_channel, RedsMigSpice *mig_target)
-- 
2.13.5

_______________________________________________
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]