From a6c8d74cd7ab5f761eb443611870acc3414f5a7e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 19 Apr 2023 09:20:36 -0400 Subject: [PATCH] util/debug: move null checks out of debug message macro this otherwise causes tons of compiler warnings cc: mesa-stable Reviewed-by: Emma Anholt Part-of: --- src/util/u_debug.c | 5 +++-- src/util/u_debug.h | 8 +++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/util/u_debug.c b/src/util/u_debug.c index d3bedca..61f628e 100644 --- a/src/util/u_debug.c +++ b/src/util/u_debug.c @@ -67,10 +67,11 @@ _util_debug_message(struct util_debug_callback *cb, enum util_debug_type type, const char *fmt, ...) { + if (!cb || !cb->debug_message) + return; va_list args; va_start(args, fmt); - if (cb && cb->debug_message) - cb->debug_message(cb->data, id, type, fmt, args); + cb->debug_message(cb->data, id, type, fmt, args); va_end(args); } diff --git a/src/util/u_debug.h b/src/util/u_debug.h index 4385be9..e1a3113 100644 --- a/src/util/u_debug.h +++ b/src/util/u_debug.h @@ -262,11 +262,9 @@ debug_get_version_option(const char *name, unsigned *major, unsigned *minor); */ #define util_debug_message(cb, type, fmt, ...) do { \ static unsigned id = 0; \ - if ((cb) && (cb)->debug_message) { \ - _util_debug_message(cb, &id, \ - UTIL_DEBUG_TYPE_ ## type, \ - fmt, ##__VA_ARGS__); \ - } \ + _util_debug_message(cb, &id, \ + UTIL_DEBUG_TYPE_ ## type, \ + fmt, ##__VA_ARGS__); \ } while (0) void -- 2.7.4