Re: [spice-server] stat: Make stat_compress_init/stat_init the same

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

 



Hi,

Acked-by: Pavel Grunt <pgrunt@xxxxxxxxxx>

just a comment below.

On Mon, 2016-01-11 at 19:02 +0100, Christophe Fergeau wrote:
> When COMPRESS_STAT is not set, and RED_WORKER_STAT is set,
> stat_time() will be a no-op, but stat_start_time_init() will try to
> use
> stat_info_t::clock. This causes a compile warning on 32 bit arches
> (not
> sure why not on 64 bit builds), as well as an error from valgrind.
> 
> Since stat_time() and stat_compress_time() are both doing the same
> work,
> this commit makes them the same function, which ensures
> stat_info_t::clock will be set and stat_start_time_init() can be used
> regardless of the _init() method which is called.
> ---
>  server/stat.h | 28 ++++++++++++----------------
>  1 file changed, 12 insertions(+), 16 deletions(-)
> 
> diff --git a/server/stat.h b/server/stat.h
> index adbf46b..ed6ac73 100644
> --- a/server/stat.h
> +++ b/server/stat.h
> @@ -101,15 +101,22 @@ static inline void stat_reset(G_GNUC_UNUSED
> stat_info_t *info)
>  #endif
>  }
>  
> +static inline void stat_init(stat_info_t *info,
> +                             const char *name,
> +                             clockid_t clock)
now the parameters can be "unused" here

> +{
> +#if defined(RED_WORKER_STAT) || defined(COMPRESS_STAT)
> +    info->name = name;
> +    info->clock = clock;
> +    stat_reset(info);
> +#endif
> +}
> +
>  static inline void stat_compress_init(G_GNUC_UNUSED stat_info_t
> *info,
>                                        G_GNUC_UNUSED const char
> *name,
>                                        G_GNUC_UNUSED clockid_t clock)
but they are used here

Pavel
>  {
> -#ifdef COMPRESS_STAT
> -    info->name = name;
> -    info->clock = clock;
> -    stat_reset(info);
> -#endif
> +    stat_init(info, name, clock);
>  }
>  
>  static inline void stat_compress_add(G_GNUC_UNUSED stat_info_t
> *info,
> @@ -134,17 +141,6 @@ static inline double stat_byte_to_mega(uint64_t
> size)
>      return (double)size / (1000 * 1000);
>  }
>  
> -static inline void stat_init(G_GNUC_UNUSED stat_info_t *info,
> -                             G_GNUC_UNUSED const char *name,
> -                             G_GNUC_UNUSED clockid_t clock)
> -{
> -#ifdef RED_WORKER_STAT
> -    info->name = name;
> -    info->clock = clock;
> -    stat_reset(info);
> -#endif
> -}
> -
>  static inline void stat_add(G_GNUC_UNUSED stat_info_t *info,
>                              G_GNUC_UNUSED stat_start_time_t start)
>  {
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]