[Spice-devel] [PATCH] declare and use message for RED_WORKER_MESSAGE_GL_SCANOUT

Frediano Ziglio fziglio at redhat.com
Wed Mar 23 13:57:53 UTC 2016


> 
> On Wed, Mar 23, 2016 at 01:06:26PM +0000, Frediano Ziglio wrote:
> > All other messages (even empty ones) have a structure defined.
> 
> This is purely for consistency? Or was this causing issues?
> 

I don't think this patch is going to change much bits of code.
Pure consistency.

> > 
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >  server/red-qxl.c    | 3 ++-
> >  server/red-qxl.h    | 3 +++
> >  server/red-worker.c | 2 +-
> >  3 files changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/server/red-qxl.c b/server/red-qxl.c
> > index 7ef9fe1..4c1c3e6 100644
> > --- a/server/red-qxl.c
> > +++ b/server/red-qxl.c
> > @@ -853,6 +853,7 @@ void spice_qxl_gl_scanout(QXLInstance *qxl,
> >                            uint32_t stride, uint32_t format,
> >                            int y_0_top)
> >  {
> > +    RedWorkerMessageGlScanout payload;
> >      spice_return_if_fail(qxl != NULL);
> >  
> >      QXLState *qxl_state = qxl->st;
> > @@ -877,7 +878,7 @@ void spice_qxl_gl_scanout(QXLInstance *qxl,
> >  
> >      /* FIXME: find a way to coallesce all pending SCANOUTs */
> >      dispatcher_send_message(&qxl_state->dispatcher,
> > -                            RED_WORKER_MESSAGE_GL_SCANOUT, NULL);
> > +                            RED_WORKER_MESSAGE_GL_SCANOUT, &payload);
> 
> I'd set payload to 0 with
> RedWorkerMessageGlScanout payload = { 0, };
> or something like that if that's possible. Or add a comment that payload

I could use payload = {};
However there are lot of similar structures without any comment or empty
initialization.

I'd go for a

payload = { /* empty */ };

> is a dummy empty struct. Otherwise it looks like we are sending
> uninitialized data.
> 
> Acked-by: Christophe Fergeau <cfergeau at redhat.com>
> 
> Christophe
> 

Frediano


More information about the Spice-devel mailing list