[Spice-devel] [spice-common v3 3/6] test-region: Replace direct printf with g_debug() calls

Christophe Fergeau cfergeau at redhat.com
Wed Jun 27 10:18:21 UTC 2018


On Wed, Jun 27, 2018 at 06:04:16AM -0400, Frediano Ziglio wrote:
> > 
> > Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> > ---
> >  common/region.c     |  28 ++++++------
> >  tests/test-region.c | 106 ++++++++++++++++++++++----------------------
> >  2 files changed, 67 insertions(+), 67 deletions(-)
> > 
> > diff --git a/common/region.c b/common/region.c
> > index c950a9b..d690167 100644
> > --- a/common/region.c
> > +++ b/common/region.c
> > @@ -496,29 +496,29 @@ void region_dump(const QRegion *rgn, const char
> > *prefix)
> >      pixman_box32_t *rects, *extents;
> >      int n_rects, i;
> >  
> > -    printf("%sREGION: %p, ", prefix, rgn);
> > +    g_debug("%sREGION: %p, ", prefix, rgn);
> >  
> >      if (!pixman_region32_not_empty((pixman_region32_t *)rgn)) {
> > -        printf("EMPTY\n");
> > +        g_debug("EMPTY");
> >          return;
> >      }
> >  
> >      extents = pixman_region32_extents((pixman_region32_t *)rgn);
> >      rects = pixman_region32_rectangles((pixman_region32_t *)rgn, &n_rects);
> > -    printf("num %u bounds (%d, %d, %d, %d)\n",
> > -           n_rects,
> > -           extents->x1,
> > -           extents->y1,
> > -           extents->x2,
> > -           extents->y2);
> > +    g_debug("num %u bounds (%d, %d, %d, %d)",
> > +            n_rects,
> > +            extents->x1,
> > +            extents->y1,
> > +            extents->x2,
> > +            extents->y2);
> >  
> >  
> >      for (i = 0; i < n_rects; i++) {
> > -        printf("%*s  %12d %12d %12d %12d\n",
> > -               (int)strlen(prefix), "",
> > -               rects[i].x1,
> > -               rects[i].y1,
> > -               rects[i].x2,
> > -               rects[i].y2);
> > +        g_debug("%*s  %12d %12d %12d %12d",
> > +                (int)strlen(prefix), "",
> > +                rects[i].x1,
> > +                rects[i].y1,
> > +                rects[i].x2,
> > +                rects[i].y2);
> >      }
> >  }
> 
> Sorry, why are you changing this function?
> This is not part only of the tests.
> Can I remove this hunk?

I don't think it's that great to have code directly calling printf. I
can remove the calls to region_dump() in the test case instead..

Christophe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180627/59c0c915/attachment.sig>


More information about the Spice-devel mailing list