> > On Thu, 2016-01-14 at 09:38 -0500, Frediano Ziglio wrote: > > > > > > From: Jonathon Jongsma <jjongsma@xxxxxxxxxx> > > > > > > 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; > > > + > > > > Why not just exporting this global as > > > > extern struct RedsState *reds; > > > > removing all other changes? > > At the end of these patches the variable is removed. > > The typedef was moved from the private header to the public header so that we > can use this shorter type in other files that don't have access to the > private > implementation of RedsState. So, function arguments can use "RedsState*" > rather > than having to use "struct RedsState*" everywhere. It doesn't need to be done > in > the same commit that changes the variable to external linkage, but I think we > should still move this typedef to the 'public' header at some point so that > different files can refer to this type consistently. > > Jonathon > > Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx> Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel