[Spice-devel] [PATCH spice 1/2] Allow to compile without RED_STATISTICS
Frediano Ziglio
fziglio at redhat.com
Wed Oct 26 14:54:33 UTC 2016
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.
> 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.
> @@ -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.
> @@ -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.
Frediano
More information about the Spice-devel
mailing list