[Spice-devel] [PATCH 06/15] Change reds_num_of_channels() to take RedsState arg

Frediano Ziglio fziglio at redhat.com
Mon Jan 18 08:38:00 PST 2016


From: Jonathon Jongsma <jjongsma at redhat.com>

---
 server/main-channel.c | 2 +-
 server/reds.c         | 2 +-
 server/reds.h         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/main-channel.c b/server/main-channel.c
index 2a9f0ce..1b774f3 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -348,7 +348,7 @@ static void main_channel_marshall_channels(RedChannelClient *rcc,
 
     red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_CHANNELS_LIST, item);
     channels_info = (SpiceMsgChannels *)spice_malloc(sizeof(SpiceMsgChannels)
-                            + reds_num_of_channels() * sizeof(SpiceChannelId));
+                            + reds_num_of_channels(reds) * sizeof(SpiceChannelId));
     reds_fill_channels(channels_info);
     spice_marshall_msg_main_channels_list(m, channels_info);
     free(channels_info);
diff --git a/server/reds.c b/server/reds.c
index 11f0e1a..9b28a7c 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -891,7 +891,7 @@ void reds_handle_agent_mouse_event(RedsState *reds, const VDAgentMouseState *mou
     spice_char_device_write_buffer_add(reds->agent_state.base, char_dev_buf);
 }
 
-int reds_num_of_channels(void)
+int reds_num_of_channels(RedsState *reds)
 {
     return reds ? reds->num_of_channels : 0;
 }
diff --git a/server/reds.h b/server/reds.h
index 76262ce..65e8f69 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -87,7 +87,7 @@ void reds_client_disconnect(RedsState *reds, RedClient *client);
 typedef struct MainMigrateData MainMigrateData;
 void reds_marshall_migrate_data(SpiceMarshaller *m);
 void reds_fill_channels(SpiceMsgChannels *channels_info);
-int reds_num_of_channels(void);
+int reds_num_of_channels(RedsState *reds);
 int reds_num_of_clients(void);
 #ifdef RED_STATISTICS
 void reds_update_stat_value(uint32_t value);
-- 
2.4.3



More information about the Spice-devel mailing list