From 169463df0e28d011988d3f9fe16af3b7a2db2db9 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sat, 12 Jun 2021 08:13:27 -0400 Subject: Created `macros.h`. This header contains any macros that're widely used throughout the codebase. --- macros.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 macros.h diff --git a/macros.h b/macros.h new file mode 100644 index 0000000..8b8267a --- /dev/null +++ b/macros.h @@ -0,0 +1,14 @@ +#ifndef MACROS_H +#define MACROS_H + +#define log(priority, ...) syslog(priority, __VA_ARGS__) + +#define did_fail(cond, ...) {\ + if (cond) {\ + log(LOG_ERR, __VA_ARGS__); \ + return -1; \ + }\ +} + +#define did_fail_reason(cond, msg, ...) did_fail(cond, msg " Reason: %s", __VA_ARGS__) +#endif -- cgit v1.2.3-13-gbd6f