diff --git a/clutter/clutter-debug.h b/clutter/clutter-debug.h index 8faaf4899..7cf7f4a50 100644 --- a/clutter/clutter-debug.h +++ b/clutter/clutter-debug.h @@ -3,7 +3,6 @@ #include #include "clutter-main.h" -#include "clutter-profile.h" G_BEGIN_DECLS @@ -50,25 +49,24 @@ typedef enum { #ifdef __GNUC__ /* Try the GCC extension for valists in macros */ -#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \ - if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \ - { _clutter_profile_trace_message ("[" #type "]:" \ - G_STRLOC ": " x, ##a); } \ - } G_STMT_END +#define CLUTTER_NOTE(type,x,a...) G_STMT_START { \ + if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \ + _clutter_debug_message ("[" #type "]:" \ + G_STRLOC ": " x, ##a); \ + } } G_STMT_END #else /* !__GNUC__ */ /* Try the C99 version; unfortunately, this does not allow us to pass * empty arguments to the macro, which means we have to * do an intemediate printf. */ -#define CLUTTER_NOTE(type,...) G_STMT_START { \ - if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) \ - { \ - gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ - _clutter_profile_trace_message ("[" #type "]:" \ - G_STRLOC ": %s",_fmt); \ - g_free (_fmt); \ - } } G_STMT_END +#define CLUTTER_NOTE(type,...) G_STMT_START { \ + if (G_UNLIKELY (CLUTTER_HAS_DEBUG (type))) { \ + gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ + _clutter_debug_message ("[" #type "]:" \ + G_STRLOC ": %s", _fmt); \ + g_free (_fmt); \ + } } G_STMT_END #endif #else /* !CLUTTER_ENABLE_DEBUG */ diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 90ec41444..49a31c3ff 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -3735,6 +3735,11 @@ _clutter_debug_messagev (const char *format, g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, var_args); +#ifdef CLUTTER_ENABLE_PROFILE + if (_clutter_uprof_context != NULL) + uprof_context_vtrace_message (_clutter_uprof_context, format, args); +#endif + g_free (fmt); } diff --git a/clutter/clutter-profile.c b/clutter/clutter-profile.c index 4b5ceb9ee..b8e0d6430 100644 --- a/clutter/clutter-profile.c +++ b/clutter/clutter-profile.c @@ -280,17 +280,4 @@ _clutter_profile_resume (void) /* NB: The Cogl context is linked to this so it will also be resumed... */ uprof_context_resume (_clutter_uprof_context); } - -void -_clutter_profile_trace_message (const char *format, ...) -{ - va_list ap; - - va_start (ap, format); - _clutter_debug_messagev (format, ap); - va_end (ap); - - if (_clutter_uprof_context != NULL) - uprof_context_vtrace_message (_clutter_uprof_context, format, ap); -} #endif diff --git a/clutter/clutter-profile.h b/clutter/clutter-profile.h index 66d42aeca..73925145c 100644 --- a/clutter/clutter-profile.h +++ b/clutter/clutter-profile.h @@ -48,21 +48,19 @@ extern guint clutter_profile_flags; void _clutter_uprof_init (void); void _clutter_profile_suspend (void); void _clutter_profile_resume (void); -void _clutter_profile_trace_message (const char *format, ...); #else /* CLUTTER_ENABLE_PROFILE */ #define CLUTTER_STATIC_TIMER(A,B,C,D,E) extern void _clutter_dummy_decl (void) #define CLUTTER_STATIC_COUNTER(A,B,C,D) extern void _clutter_dummy_decl (void) -#define CLUTTER_COUNTER_INC(A,B) G_STMT_START{ (void)0; }G_STMT_END -#define CLUTTER_COUNTER_DEC(A,B) G_STMT_START{ (void)0; }G_STMT_END -#define CLUTTER_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END -#define CLUTTER_TIMER_STOP(A,B) G_STMT_START{ (void)0; }G_STMT_END +#define CLUTTER_COUNTER_INC(A,B) G_STMT_START { } G_STMT_END +#define CLUTTER_COUNTER_DEC(A,B) G_STMT_START { } G_STMT_END +#define CLUTTER_TIMER_START(A,B) G_STMT_START { } G_STMT_END +#define CLUTTER_TIMER_STOP(A,B) G_STMT_START { } G_STMT_END -#define _clutter_profile_suspend() G_STMT_START {} G_STMT_END -#define _clutter_profile_resume() G_STMT_START {} G_STMT_END - -#define _clutter_profile_trace_message _clutter_debug_message +#define _clutter_uprof_init G_STMT_START { } G_STMT_END +#define _clutter_profile_suspend G_STMT_START { } G_STMT_END +#define _clutter_profile_resume G_STMT_START { } G_STMT_END #endif /* CLUTTER_ENABLE_PROFILE */