[Spice-devel] [PATCH v2] Remove duplicate typedef from headers

Frediano Ziglio fziglio at redhat.com
Fri Apr 1 13:52:42 UTC 2016


> 
> Hey,
> 
> On Thu, Mar 31, 2016 at 08:24:00AM +0100, Frediano Ziglio wrote:
> > diff --git a/server/reds-stream.h b/server/reds-stream.h
> > index 1123048..b31bc34 100644
> > --- a/server/reds-stream.h
> > +++ b/server/reds-stream.h
> > @@ -28,7 +28,6 @@
> >  typedef void (*AsyncReadDone)(void *opaque);
> >  typedef void (*AsyncReadError)(void *opaque, int err);
> >  
> > -typedef struct RedsState RedsState;
> >  typedef struct RedsStream RedsStream;
> >  typedef struct RedsStreamPrivate RedsStreamPrivate;
> >  
> > @@ -68,7 +67,7 @@ void reds_stream_push_channel_event(RedsStream *s, int
> > event);
> >  void reds_stream_remove_watch(RedsStream* s);
> >  void reds_stream_set_channel(RedsStream *stream, int connection_id,
> >                               int channel_type, int channel_id);
> > -RedsStream *reds_stream_new(RedsState *reds, int socket);
> > +RedsStream *reds_stream_new(struct RedsState *reds, int socket);
> >  bool reds_stream_is_ssl(RedsStream *stream);
> >  RedsStreamSslStatus reds_stream_ssl_accept(RedsStream *stream);
> 
> Not a big fan either of having reds-stream.h using struct RedsState
> while everywhere else RedsState is used. I still prefer my initial
> version, or alternatively, a red-types.h header where the RedsState
> typedef could go.
> 
> Christophe
> 

Why not including reds.h in reds-stream.h ?

I think a no written role is use typedef where the structure is defined.
If I remember in the past we refused typedef just where the compiler was happy.
I think this is also the GObject style.
Some time ago we discussed about defining all typedefs in red-common.h.
I think in other header we already have "SpiceServer" or "struct RedsState".

Frediano


More information about the Spice-devel mailing list