util/debug: move null checks out of debug message macro

this otherwise causes tons of compiler warnings

cc: mesa-stable

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22196>
This commit is contained in:
Mike Blumenkrantz 2023-04-19 09:20:36 -04:00 committed by Marge Bot
parent 3909471288
commit a6c8d74cd7
2 changed files with 6 additions and 7 deletions

View file

@ -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);
}

View file

@ -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