[clutter] debug: Clean up profile/debug symbols



commit 8a4dc3c011fb3dfe8157dfc228fedd72a81c3c12
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Nov 18 17:44:42 2011 +0000

    debug: Clean up profile/debug symbols
    
    Since we have a _clutter_debug_message() function compiled in
    unconditionally we have no further need for the equivalent conditional
    version defined in clutter-profile.[ch]: we can simply do the work in
    one function.

 clutter/clutter-debug.h   |   26 ++++++++++++--------------
 clutter/clutter-main.c    |    5 +++++
 clutter/clutter-profile.c |   13 -------------
 clutter/clutter-profile.h |   18 ++++++++----------
 4 files changed, 25 insertions(+), 37 deletions(-)
---
diff --git a/clutter/clutter-debug.h b/clutter/clutter-debug.h
index 8faaf48..7cf7f4a 100644
--- a/clutter/clutter-debug.h
+++ b/clutter/clutter-debug.h
@@ -3,7 +3,6 @@
 
 #include <glib.h>
 #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 90ec414..49a31c3 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 4b5ceb9..b8e0d64 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 66d42ae..7392514 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_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_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_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 */
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]