aboutgitcodebugslistschat
path: root/log.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2023-02-27 04:06:19 +0100
committerStefano Brivio <sbrivio@redhat.com>2023-02-27 18:55:57 +0100
commitd2df7632321c473cd57064e2350b219fbc3f6677 (patch)
treeec81d4c0e51397e48f95f43d6180fb1bac69e3b6 /log.h
parentfb05a713789fd9c20d0432f023ce26f3c5b94251 (diff)
downloadpasst-d2df7632321c473cd57064e2350b219fbc3f6677.tar
passt-d2df7632321c473cd57064e2350b219fbc3f6677.tar.gz
passt-d2df7632321c473cd57064e2350b219fbc3f6677.tar.bz2
passt-d2df7632321c473cd57064e2350b219fbc3f6677.tar.lz
passt-d2df7632321c473cd57064e2350b219fbc3f6677.tar.xz
passt-d2df7632321c473cd57064e2350b219fbc3f6677.tar.zst
passt-d2df7632321c473cd57064e2350b219fbc3f6677.zip
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 36f0199f6ef4 ("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>
Diffstat (limited to 'log.h')
-rw-r--r--log.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/log.h b/log.h
index d4e9d85..d4ea141 100644
--- a/log.h
+++ b/log.h
@@ -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(...) \