debug: Use G_UNLIKELY in the tests

Debugging code is not meant to be run in the nominal code path. Use
G_UNLIKELY to be reduce the number of bubbles in the instruction
pipeline.

Took the opportunity to re-indent the macros.
This commit is contained in:
Damien Lespiau 2010-05-03 20:41:17 +02:00
parent dc4c0e3d3e
commit 6243a5dc34

View File

@ -53,13 +53,13 @@ typedef enum {
#ifdef __GNUC__
#define COGL_NOTE(type,x,a...) G_STMT_START { \
if (cogl_debug_flags & COGL_DEBUG_##type) { \
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_##type)) { \
g_message ("[" #type "] " G_STRLOC ": " x, ##a); \
} } G_STMT_END
#else
#define COGL_NOTE(type,...) G_STMT_START { \
if (cogl_debug_flags & COGL_DEBUG_##type) { \
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_##type)) { \
char *_fmt = g_strdup_printf (__VA_ARGS__); \
g_message ("[" #type "] " G_STRLOC ": %s", _fmt); \
g_free (_fmt); \