[Spice-devel] [spice-server 2/3] dcc: Rework COMPRESS_DEBUG macro
Frediano Ziglio
fziglio at redhat.com
Thu Jul 19 14:39:55 UTC 2018
>
> On 07/19/2018 03:54 PM, Christophe Fergeau wrote:
> > 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().
>
> It was a good opportunity, but the code calls g_debug.
>
> Why not use g_info ?
> I see documentation says it's "Seldom used."
>
> Uri.
>
Actually in the commit message there is a typo/error, the macro
called was spice_debug, not spice_info so changing to g_debug
was not changing much.
> > ---
> > 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
> > +
> > +
> > 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;
> >
More information about the Spice-devel
mailing list