summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-12-04 17:44:29 -0700
committerBrian Paul <[email protected]>2015-12-07 08:56:51 -0700
commit5effc3ae744807d03c6779040d752c74ed4abfbf (patch)
tree8b6ab84952de8a919932ff485a1ac22013e66b96 /src
parentb19546abf386268e06464624bd6638cf61e595b6 (diff)
gallium/util: check callback pointers for non-null in pipe_debug_message()
So the callers don't have to do it. v2: also check cb!=NULL in the macro Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_debug.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 99007039a7c..5307072fa3a 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -268,9 +268,11 @@ void _debug_assert_fail(const char *expr,
*/
#define pipe_debug_message(cb, type, fmt, ...) do { \
static unsigned id = 0; \
- _pipe_debug_message(cb, &id, \
- PIPE_DEBUG_TYPE_ ## type, \
- fmt, ##__VA_ARGS__); \
+ if ((cb) && (cb)->debug_message) { \
+ _pipe_debug_message(cb, &id, \
+ PIPE_DEBUG_TYPE_ ## type, \
+ fmt, ##__VA_ARGS__); \
+ } \
} while (0)
struct pipe_debug_callback;