[Spice-devel] [PATCH spice 12/18] Declare AsyncCommand in red-common

Frediano Ziglio fziglio at redhat.com
Wed Dec 16 05:46:13 PST 2015


> Hi
> 
> ----- Original Message -----
> > 
> > > > > This is the simplest way I could find to have a AsyncCommand in
> > > > > QXLState in following patch.
> > > > > 
> > > > 
> > > > The following patch just update spice-common repository.
> > > > This patch is referring the "following"?
> > > > 
> > > > The reasoning looks a bit weak to me.
> > > 
> > > Why? I just wanted to store the current gl-draw AsyncCommand in QXLState.
> > > 
> > 
> > You can just use
> > 
> > struct AsyncCommand *aync_command;
> > 
> > like for dispatcher
> 
> Correct, that seems to be a common practice in Spice server code. I'll change
> the series to use that instead then. However, it would be nice to consider
> having the common typedefs in common imho. It doesn't make sense to me that
> in some header you can use "Foo" type directly and some you don't and have
> to use "struct Foo".
> 

Would it make sense if all typedefs like these were in a single file (could
be red-common.h) included were typedefs are needed?
Not far from your suggestion, just in a consistent way.
Would solve this problem and also helps making compilers which do not like
double typedefs (like rhel6 one) happy.

Frediano

> 
> > > > 
> > > > > Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
> > > > > ---
> > > > >  server/red-common.h     | 2 ++
> > > > >  server/red-dispatcher.h | 2 --
> > > > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/server/red-common.h b/server/red-common.h
> > > > > index f6098f6..5a2c76c 100644
> > > > > --- a/server/red-common.h
> > > > > +++ b/server/red-common.h
> > > > > @@ -39,4 +39,6 @@
> > > > >  #include "spice.h"
> > > > >  #include "utils.h"
> > > > >  
> > > > > +typedef struct AsyncCommand AsyncCommand;
> > > > > +
> > > > >  #endif
> > > > > diff --git a/server/red-dispatcher.h b/server/red-dispatcher.h
> > > > > index d99695d..7aabe44 100644
> > > > > --- a/server/red-dispatcher.h
> > > > > +++ b/server/red-dispatcher.h
> > > > > @@ -22,8 +22,6 @@
> > > > >  
> > > > >  typedef struct RedDispatcher RedDispatcher;
> > > > >  
> > > > > -typedef struct AsyncCommand AsyncCommand;
> > > > > -
> > > > >  void red_dispatcher_init(QXLInstance *qxl);
> > > > >  
> > > > >  void red_dispatcher_on_ic_change(void);
> > 


More information about the Spice-devel mailing list