[PATCH 14/18] Move spice_uuid, spice_uuid_is_set to RedsState struct

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

 



From: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

Removing more global variables
---
 server/reds-private.h |  4 ++++
 server/reds.c         | 13 ++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/server/reds-private.h b/server/reds-private.h
index 506ef8c..96dfa6a 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -212,6 +212,10 @@ struct RedsState {
     char *sasl_appname;
 #endif
     char *spice_name;
+
+    bool spice_uuid_is_set;
+    uint8_t spice_uuid[16];
+
 };
 
 #endif
diff --git a/server/reds.c b/server/reds.c
index 3889083..f21e92a 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -143,9 +143,6 @@ static SpiceCoreInterfaceInternal core_interface_adapter = {
 #define REDS_TOKENS_TO_SEND 5
 #define REDS_VDI_PORT_NUM_RECEIVE_BUFFS 5
 
-static bool spice_uuid_is_set = FALSE;
-static uint8_t spice_uuid[16] = { 0, };
-
 static int ticketing_enabled = 1; //Ticketing is enabled by default
 static pthread_mutex_t *lock_cs;
 static long *lock_count;
@@ -1699,8 +1696,8 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
             red_dispatcher_qxl_ram_size());
         if (reds->spice_name)
             main_channel_push_name(mcc, reds->spice_name);
-        if (spice_uuid_is_set)
-            main_channel_push_uuid(mcc, spice_uuid);
+        if (reds->spice_uuid_is_set)
+            main_channel_push_uuid(mcc, reds->spice_uuid);
     } else {
         reds_mig_target_client_add(reds, client);
     }
@@ -3436,6 +3433,8 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
 #if HAVE_SASL
     reds->sasl_appname = NULL; // default to "spice" if NULL
 #endif
+    reds->spice_uuid_is_set = FALSE;
+    memset(reds->spice_uuid, 0, sizeof(reds->spice_uuid));
     return reds;
 }
 
@@ -3591,8 +3590,8 @@ SPICE_GNUC_VISIBLE void spice_server_set_name(SpiceServer *s, const char *name)
 
 SPICE_GNUC_VISIBLE void spice_server_set_uuid(SpiceServer *s, const uint8_t uuid[16])
 {
-    memcpy(spice_uuid, uuid, sizeof(spice_uuid));
-    spice_uuid_is_set = TRUE;
+    memcpy(s->spice_uuid, uuid, sizeof(s->spice_uuid));
+    s->spice_uuid_is_set = TRUE;
 }
 
 SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *reds,
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]