summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2013-01-31 14:36:38 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2013-02-13 02:18:01 -0500
commit4dced81c917c753a4e699e3793efa15a39361cf0 (patch)
treee3c91d87cafd4fc26385b114ece54bc349077dce
parentf4c9492c12d98f76d99b4dbdca56d517e1ffdb19 (diff)
Turn on error logging at all times
While releasing 0.29.2 the distcheck run produced a number of error messages that had to be fixed in 349015e1fc5d912ba4253133b90e751d0b. These were not caught before so nobody had actually run pixman with debugging turned on. It's not the first time this has happened, see 5b0563f39eb29e4ae431717696174da5 for example. So this patch makes the return_if_fail() macros use unlikely() around the expressions and then turns on error logging at all times. The performance hit should negligible since we were already evaluating the expressions. The place where DEBUG actually does cause a performance hit is in the region selfcheck code, and that will still only be enabled in development snapshots.
-rw-r--r--pixman/pixman-private.h36
-rw-r--r--pixman/pixman-utils.c4
2 files changed, 3 insertions, 37 deletions
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index cb78a2e..181ab5c 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -1014,15 +1014,13 @@ float pixman_unorm_to_float (uint16_t u, int n_bits);
#endif
-#ifdef DEBUG
-
void
_pixman_log_error (const char *function, const char *message);
#define return_if_fail(expr) \
do \
{ \
- if (!(expr)) \
+ if (unlikely (!(expr))) \
{ \
_pixman_log_error (FUNC, "The expression " # expr " was false"); \
return; \
@@ -1033,7 +1031,7 @@ _pixman_log_error (const char *function, const char *message);
#define return_val_if_fail(expr, retval) \
do \
{ \
- if (!(expr)) \
+ if (unlikely (!(expr))) \
{ \
_pixman_log_error (FUNC, "The expression " # expr " was false"); \
return (retval); \
@@ -1044,39 +1042,11 @@ _pixman_log_error (const char *function, const char *message);
#define critical_if_fail(expr) \
do \
{ \
- if (!(expr)) \
+ if (unlikely (!(expr))) \
_pixman_log_error (FUNC, "The expression " # expr " was false"); \
} \
while (0)
-
-#else
-
-#define _pixman_log_error(f,m) do { } while (0)
-
-#define return_if_fail(expr) \
- do \
- { \
- if (!(expr)) \
- return; \
- } \
- while (0)
-
-#define return_val_if_fail(expr, retval) \
- do \
- { \
- if (!(expr)) \
- return (retval); \
- } \
- while (0)
-
-#define critical_if_fail(expr) \
- do \
- { \
- } \
- while (0)
-#endif
-
/*
* Matrix
*/
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index b1e9fb6..f31171f 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -292,8 +292,6 @@ _pixman_internal_only_get_implementation (void)
return get_implementation ();
}
-#ifdef DEBUG
-
void
_pixman_log_error (const char *function, const char *message)
{
@@ -310,5 +308,3 @@ _pixman_log_error (const char *function, const char *message)
n_messages++;
}
}
-
-#endif