[Spice-devel] [PATCH 10/16] Move default_renderer into RedsState
Frediano Ziglio
fziglio at redhat.com
Thu Jan 28 06:39:22 PST 2016
>
> On Wed, 2016-01-27 at 12:48 +0000, Frediano Ziglio wrote:
> > From: Jonathon Jongsma <jjongsma at redhat.com>
> >
> > Not global.
>
> Looking at PATCH 12/16: What is the usage of the field? It is
> initialized in spice_server_new(), added to renderers in
> spice_server_init() and cleared when spice_server_add_renderer() is
> called. Why not add the default_renderer to renderers immediately after
> they are created? Is it because the user can call spice_server_new() ->
> spice_server_add_renderer() -> spice_server_init() ?
>
> Pavel
>
Your comment make sense but the purpose of the patch is to
remove a global.
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Frediano
> > ---
> > server/reds-private.h | 1 +
> > server/reds.c | 8 ++++----
> > 2 files changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/server/reds-private.h b/server/reds-private.h
> > index 63e856e..75a4f59 100644
> > --- a/server/reds-private.h
> > +++ b/server/reds-private.h
> > @@ -195,6 +195,7 @@ struct RedsState {
> >
> > int default_channel_security;
> > ChannelSecurityOptions *channels_security;
> > + const char *default_renderer;
> > };
> >
> > #endif
> > diff --git a/server/reds.c b/server/reds.c
> > index 5804d13..f35b602 100644
> > --- a/server/reds.c
> > +++ b/server/reds.c
> > @@ -154,7 +154,6 @@ static int spice_secure_port = -1;
> > static int spice_listen_socket_fd = -1;
> > static char spice_addr[256];
> > static int spice_family = PF_UNSPEC;
> > -static const char *default_renderer = "sw";
> > static int sasl_enabled = 0; // sasl disabled by default
> > #if HAVE_SASL
> > static char *sasl_appname = NULL; // default to "spice" if NULL
> > @@ -3444,6 +3443,7 @@ SPICE_GNUC_VISIBLE SpiceServer
> > *spice_server_new(void)
> > reds = spice_new0(RedsState, 1);
> > reds->default_channel_security =
> > SPICE_CHANNEL_SECURITY_NONE | SPICE_CHANNEL_SECURITY_SSL;
> > + reds->default_renderer = "sw";
> > return reds;
> > }
> >
> > @@ -3489,8 +3489,8 @@ SPICE_GNUC_VISIBLE int
> > spice_server_init(SpiceServer *s, SpiceCoreInterface *cor
> >
> > spice_assert(reds == s);
> > ret = do_spice_init(s, core);
> > - if (default_renderer) {
> > - red_add_renderer(default_renderer);
> > + if (s->default_renderer) {
> > + red_add_renderer(s->default_renderer);
> > }
> > return ret;
> > }
> > @@ -3784,7 +3784,7 @@ SPICE_GNUC_VISIBLE int
> > spice_server_add_renderer(SpiceServer *s, const char *nam
> > if (!red_add_renderer(name)) {
> > return -1;
> > }
> > - default_renderer = NULL;
> > + s->default_renderer = NULL;
> > return 0;
> > }
> >
>
More information about the Spice-devel
mailing list