diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-06-20 14:07:51 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-06-20 14:07:51 +0200 |
| commit | 71c0188306377940ae172dceb58f2bd5f4fcdb4f (patch) | |
| tree | 7f08457ecfb35f908ec26929ebd84d8a0ca125ae /src/cube.c | |
| parent | e986713657bc5f9880e91ed49dd9b0d0227f048d (diff) | |
| download | nissy-core-71c0188306377940ae172dceb58f2bd5f4fcdb4f.tar.gz nissy-core-71c0188306377940ae172dceb58f2bd5f4fcdb4f.zip | |
Changed logger from va_args to ...
Diffstat (limited to 'src/cube.c')
| -rw-r--r-- | src/cube.c | 19 |
1 files changed, 4 insertions, 15 deletions
| @@ -3,27 +3,16 @@ | |||
| 3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
| 4 | #include <string.h> | 4 | #include <string.h> |
| 5 | 5 | ||
| 6 | void (*nissy_log)(const char *, va_list); | 6 | void (*nissy_log)(const char *, ...); |
| 7 | 7 | ||
| 8 | void | 8 | #define LOG(...) if (nissy_log != NULL) nissy_log(__VA_ARGS__); |
| 9 | _log(const char *str, ...) /* TODO: rename */ | ||
| 10 | { | ||
| 11 | va_list args; | ||
| 12 | |||
| 13 | if (nissy_log != NULL) { | ||
| 14 | va_start(args, str); | ||
| 15 | nissy_log(str, args); | ||
| 16 | va_end(args); | ||
| 17 | } | ||
| 18 | } | ||
| 19 | 9 | ||
| 20 | #ifdef DEBUG | 10 | #ifdef DEBUG |
| 21 | #define _static | 11 | #define _static |
| 22 | #define _static_inline | 12 | #define _static_inline |
| 23 | #define DBG_WARN(condition, ...) if (!(condition)) _log(__VA_ARGS__); | 13 | #define DBG_WARN(condition, ...) if (!(condition)) LOG(__VA_ARGS__); |
| 24 | #define DBG_ASSERT(condition, retval, ...) \ | 14 | #define DBG_ASSERT(condition, retval, ...) \ |
| 25 | if (!(condition)) { _log(__VA_ARGS__); return retval; } | 15 | if (!(condition)) { LOG(__VA_ARGS__); return retval; } |
| 26 | |||
| 27 | #else | 16 | #else |
| 28 | #define _static static | 17 | #define _static static |
| 29 | #define _static_inline static inline | 18 | #define _static_inline static inline |
