From 71c0188306377940ae172dceb58f2bd5f4fcdb4f Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 20 Jun 2024 14:07:51 +0200 Subject: Changed logger from va_args to ... --- src/cube.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/cube.c') diff --git a/src/cube.c b/src/cube.c index 890e3fb..54876a7 100644 --- a/src/cube.c +++ b/src/cube.c @@ -3,27 +3,16 @@ #include #include -void (*nissy_log)(const char *, va_list); +void (*nissy_log)(const char *, ...); -void -_log(const char *str, ...) /* TODO: rename */ -{ - va_list args; - - if (nissy_log != NULL) { - va_start(args, str); - nissy_log(str, args); - va_end(args); - } -} +#define LOG(...) if (nissy_log != NULL) nissy_log(__VA_ARGS__); #ifdef DEBUG #define _static #define _static_inline -#define DBG_WARN(condition, ...) if (!(condition)) _log(__VA_ARGS__); +#define DBG_WARN(condition, ...) if (!(condition)) LOG(__VA_ARGS__); #define DBG_ASSERT(condition, retval, ...) \ - if (!(condition)) { _log(__VA_ARGS__); return retval; } - + if (!(condition)) { LOG(__VA_ARGS__); return retval; } #else #define _static static #define _static_inline static inline -- cgit v1.3