[Spice-devel] [PATCH spice-gtk v3] Remove unnecessary debug check from SPICE_DEBUG

Marc-André Lureau marcandre.lureau at redhat.com
Fri Jun 9 18:29:16 UTC 2017


Hi

----- Original Message -----
> Hi
> 
> ----- Original Message -----
> > > If I was reading the code of a project and noticed that they checked a
> > > global variable every time before calling g_debug(), I would find that
> > > very odd. For example:
> > >
> > > void foo(void)
> > > {
> > >     if (foo_get_debug()) {
> > >         g_debug("something happened");
> > >     }
> > >     ...
> > > }
> > >
> > > Nobody does this.
> 
> Actually, that's what GTK_DEBUG_CHECK does for ex.
> #define GTK_DEBUG_CHECK(type) G_UNLIKELY (gtk_get_debug_flags () &
> GTK_DEBUG_##type)

I should add that the macro is not used for logging, but to check whether we should log something. (similar, except that there is no category/flag in spice yet).


More information about the Spice-devel mailing list