1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-09 00:55:35 +02:00

log, conf, tap: Define die() as err() plus exit(), drop cppcheck workarounds

If we define die() as a variadic macro, passing __VA_ARGS__ to err(),
and calling exit() outside err() itself, we can drop the workarounds
introduced in commit 36f0199f6e ("conf, tap: Silence two false
positive invalidFunctionArg from cppcheck").

Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio 2023-02-27 04:06:19 +01:00
parent fb05a71378
commit d2df763232
4 changed files with 12 additions and 18 deletions

7
log.h
View file

@ -10,12 +10,17 @@
#define LOGFILE_CUT_RATIO 30 /* When full, cut ~30% size */
#define LOGFILE_SIZE_MIN (5UL * MAX(BUFSIZ, PAGE_SIZE))
void die(const char *format, ...);
void err(const char *format, ...);
void warn(const char *format, ...);
void info(const char *format, ...);
void debug(const char *format, ...);
#define die(...) \
do { \
err(__VA_ARGS__); \
exit(EXIT_FAILURE); \
} while (0)
extern int log_trace;
void trace_init(int enable);
#define trace(...) \