[Spice-devel] [PATCH 13/18] Move spice_name to RedsState struct

Frediano Ziglio fziglio at redhat.com
Fri Jan 29 04:02:09 PST 2016


From: Jonathon Jongsma <jjongsma at redhat.com>

Remove more global variables
---
 server/reds-private.h | 1 +
 server/reds.c         | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/reds-private.h b/server/reds-private.h
index c94adb1..506ef8c 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -211,6 +211,7 @@ struct RedsState {
 #if HAVE_SASL
     char *sasl_appname;
 #endif
+    char *spice_name;
 };
 
 #endif
diff --git a/server/reds.c b/server/reds.c
index 7de4412..3889083 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -143,7 +143,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter = {
 #define REDS_TOKENS_TO_SEND 5
 #define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5
 
-static char *spice_name = NULL;
 static bool spice_uuid_is_set = FALSE;
 static uint8_t spice_uuid[16] = { 0, };
 
@@ -1698,8 +1697,8 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
             reds->mouse_mode, reds->is_client_mouse_allowed,
             reds_get_mm_time() - MM_TIME_DELTA,
             red_dispatcher_qxl_ram_size());
-        if (spice_name)
-            main_channel_push_name(mcc, spice_name);
+        if (reds->spice_name)
+            main_channel_push_name(mcc, reds->spice_name);
         if (spice_uuid_is_set)
             main_channel_push_uuid(mcc, spice_uuid);
     } else {
@@ -3586,8 +3585,8 @@ SPICE_GNUC_VISIBLE int spice_server_set_sasl_appname(SpiceServer *s, const char
 
 SPICE_GNUC_VISIBLE void spice_server_set_name(SpiceServer *s, const char *name)
 {
-    free(spice_name);
-    spice_name = spice_strdup(name);
+    free(s->spice_name);
+    s->spice_name = spice_strdup(name);
 }
 
 SPICE_GNUC_VISIBLE void spice_server_set_uuid(SpiceServer *s, const uint8_t uuid[16])
-- 
2.4.3



More information about the Spice-devel mailing list