[Spice-devel] [spice-server 2/3] dcc: Rework COMPRESS_DEBUG macro
Frediano Ziglio
fziglio at redhat.com
Thu Jul 19 13:25:00 UTC 2018
>
> Rather than using
> #ifdef COMPRESS_DEBUG
> spice_info(...);
> #endif
>
> we can #define COMPRESS_DEBUG to spice_info() or nothing for a slight
> readability improvement. This opportunity is used to replace these
> spice_info() calls with g_message().
Why not compress_debug at this point? (not strong about)
> ---
> server/image-encoders.c | 27 ++++++++++++---------------
> 1 file changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/server/image-encoders.c b/server/image-encoders.c
> index 880972e70..29e3a31a6 100644
> --- a/server/image-encoders.c
> +++ b/server/image-encoders.c
> @@ -32,6 +32,13 @@
>
> #define MAX_GLZ_DRAWABLE_INSTANCES 2
>
> +#if 0
> +#define COMPRESS_DEBUG g_debug
> +#else
> +#define COMPRESS_DEBUG(...)
> +#endif
> +
Would prefer
#if 0
#define COMPRESS_DEBUG(...) g_debug(__VA_ARGS__)
#else
#define COMPRESS_DEBUG(...) G_STMT_START { \
if (0) g_debug(__VA_ARGS__); \
} G_STMT_END
#endif
> +
> typedef struct RedGlzDrawable RedGlzDrawable;
> typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem;
>
> @@ -837,9 +844,7 @@ bool image_encoders_compress_quic(ImageEncoders *enc,
> SpiceImage *dest,
> stat_start_time_t start_time;
> stat_start_time_init(&start_time, &enc->shared_data->quic_stat);
>
> -#ifdef COMPRESS_DEBUG
> - spice_debug("QUIC compress");
> -#endif
> + COMPRESS_DEBUG("QUIC compress");
>
> switch (src->format) {
> case SPICE_BITMAP_FMT_32BIT:
> @@ -926,9 +931,7 @@ bool image_encoders_compress_lz(ImageEncoders *enc,
> stat_start_time_t start_time;
> stat_start_time_init(&start_time, &enc->shared_data->lz_stat);
>
> -#ifdef COMPRESS_DEBUG
> - spice_debug("LZ LOCAL compress");
> -#endif
> + COMPRESS_DEBUG("LZ LOCAL compress");
>
> encoder_data_init(&lz_data->data);
>
> @@ -997,9 +1000,7 @@ bool image_encoders_compress_jpeg(ImageEncoders *enc,
> SpiceImage *dest,
> stat_start_time_t start_time;
> stat_start_time_init(&start_time, &enc->shared_data->jpeg_alpha_stat);
>
> -#ifdef COMPRESS_DEBUG
> - spice_debug("JPEG compress");
> -#endif
> + COMPRESS_DEBUG("JPEG compress");
>
> switch (src->format) {
> case SPICE_BITMAP_FMT_16BIT:
> @@ -1114,9 +1115,7 @@ bool image_encoders_compress_lz4(ImageEncoders *enc,
> SpiceImage *dest,
> stat_start_time_t start_time;
> stat_start_time_init(&start_time, &enc->shared_data->lz4_stat);
>
> -#ifdef COMPRESS_DEBUG
> - spice_debug("LZ4 compress");
> -#endif
> + COMPRESS_DEBUG("LZ4 compress");
>
> encoder_data_init(&lz4_data->data);
>
> @@ -1226,9 +1225,7 @@ bool image_encoders_compress_glz(ImageEncoders *enc,
> int glz_size;
> int zlib_size;
>
> -#ifdef COMPRESS_DEBUG
> - spice_debug("LZ global compress fmt=%d", src->format);
> -#endif
> + COMPRESS_DEBUG("LZ global compress fmt=%d", src->format);
>
> if ((src->x * src->y) >=
> glz_enc_dictionary_get_size(enc->glz_dict->dict)) {
> return FALSE;
Frediano
More information about the Spice-devel
mailing list