[Spice-devel] [PATCH 02/15] Make global 'reds' extern

Frediano Ziglio fziglio at redhat.com
Thu Jan 14 06:33:13 PST 2016


From: Jonathon Jongsma <jjongsma at redhat.com>

This allows it to be accessed from other files. This is a temporary step
toward getting rid of the global-ness of this variable, and it allows us
to update the function signature bit-by-bit.
---
 server/reds-private.h | 4 ++--
 server/reds.c         | 2 +-
 server/reds.h         | 3 +++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/server/reds-private.h b/server/reds-private.h
index 7f4f04f..6d76943 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -135,7 +135,7 @@ typedef struct RedsClientMonitorsConfig {
     int buffer_pos;
 } RedsClientMonitorsConfig;
 
-typedef struct RedsState {
+struct RedsState {
     int listen_socket;
     int secure_listen_socket;
     SpiceWatch *listen_watch;
@@ -189,6 +189,6 @@ typedef struct RedsState {
     RedsClientMonitorsConfig client_monitors_config;
     int mm_time_enabled;
     uint32_t mm_time_latency;
-} RedsState;
+};
 
 #endif
diff --git a/server/reds.c b/server/reds.c
index bee2574..1b877aa 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -175,7 +175,7 @@ int agent_copypaste = TRUE;
 int agent_file_xfer = TRUE;
 static bool exit_on_disconnect = FALSE;
 
-static RedsState *reds = NULL;
+RedsState *reds = NULL;
 
 typedef struct RedLinkInfo {
     RedsStream *stream;
diff --git a/server/reds.h b/server/reds.h
index f3a9ce4..8e6e136 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -30,6 +30,9 @@
 #include "red-channel.h"
 #include "migration-protocol.h"
 
+typedef struct RedsState RedsState;
+extern RedsState *reds;
+
 struct QXLState {
     QXLInterface          *qif;
     struct RedDispatcher  *dispatcher;
-- 
2.4.3



More information about the Spice-devel mailing list