Re: [PATCH spice 1/2] Allow to compile without RED_STATISTICS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2016-10-26 at 10:54 -0400, Frediano Ziglio wrote:
> Looks like we are working on similar stuff!


> 
> > 
> > ---
> >  server/dcc-send.c            | 2 +-
> >  server/main-channel-client.c | 2 +-
> >  server/red-channel.c         | 6 ++----
> >  3 files changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/server/dcc-send.c b/server/dcc-send.c
> > index ef67f97..54844cf 100644
> > --- a/server/dcc-send.c
> > +++ b/server/dcc-send.c
> > @@ -185,7 +185,7 @@ static void
> > red_display_add_image_to_pixmap_cache(RedChannelClient *rcc,
> >                                                    SpiceImage
> > *image,
> >                                                    SpiceImage
> > *io_image,
> >                                                    int is_lossy)
> >  {
> > -    DisplayChannel *display_channel =
> > +    DisplayChannel *display_channel G_GNUC_UNUSED =
> >          DISPLAY_CHANNEL(red_channel_client_get_channel(rcc));
> >      DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
> >  
> > diff --git a/server/main-channel-client.c b/server/main-channel-
> > client.c
> > index 836c50e..0c8a3a4 100644
> > --- a/server/main-channel-client.c
> > +++ b/server/main-channel-client.c
> > @@ -161,11 +161,11 @@ static void
> > main_channel_client_set_property(GObject
> > *object,
> >      }
> >  }
> >  
> > -static void ping_timer_cb(void *opaque);
> >  static void main_channel_client_constructed(GObject *object)
> >  {
> >      G_OBJECT_CLASS(main_channel_client_parent_class)-
> > >constructed(object);
> >  #ifdef RED_STATISTICS
> > +    static void ping_timer_cb(void *opaque);
> >      MainChannelClient *self = MAIN_CHANNEL_CLIENT(object);
> >      RedsState *reds =
> >          red_channel_get_server(red_channel_client_get_channel(RED
> > _CHANNEL_CLIENT(object)));
> 
> I think this does not compile or cause a warning+error on rhel6.
ok, i will fix it
> 
> > diff --git a/server/red-channel.c b/server/red-channel.c
> > index 3b14fbf..12bf941 100644
> > --- a/server/red-channel.c
> > +++ b/server/red-channel.c
> > @@ -104,10 +104,8 @@ struct RedChannelPrivate
> >      // from Channel -> need to protect!
> >      pthread_t thread_id;
> >      RedsState *reds;
> > -#ifdef RED_STATISTICS
> >      StatNodeRef stat;
> >      uint64_t *out_bytes_counter;
> > -#endif
> >  };
> >  
> >  enum {
> 
> This is weird, you should not need this.
they have to be declared since they are used:
out_bytes_counter is set in red_channel_init
red_channel_set_stat_node checks  'stat'

of course these can be avoided by putting ifdefs where needed, but I
though the intention was to avoid doing that

> 
> > @@ -210,7 +208,7 @@ static void
> > red_channel_client_default_peer_on_error(RedChannelClient *rcc)
> >  static void red_channel_on_output(void *opaque, int n)
> >  {
> >      RedChannelClient *rcc = opaque;
> > -    RedChannel *self = red_channel_client_get_channel(rcc);
> > +    RedChannel *self G_GNUC_UNUSED =
> > red_channel_client_get_channel(rcc);
> >  
> >      red_channel_client_on_output(opaque, n);
> >  
> 
> I would also use the initialization.

What do you mean ?

> 
> > @@ -336,7 +334,7 @@ red_channel_init(RedChannel *self)
> >  
> >      red_channel_set_common_cap(self,
> > SPICE_COMMON_CAP_MINI_HEADER);
> >      self->priv->thread_id = pthread_self();
> > -    self->priv->out_bytes_counter = 0;
> > +    self->priv->out_bytes_counter = NULL;
> >  
> >      // TODO: send incoming_cb as parameters instead of
> > duplicating?
> >      self->priv->incoming_cb.on_error =
> 
> Actually this could even be removed as structure is zeroed at
> initialization but surely NULL is better then 0.
ok

Pavel

> 
> Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]