summaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-06-12 08:13:27 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2021-06-12 08:13:27 -0400
commit169463df0e28d011988d3f9fe16af3b7a2db2db9 (patch)
treeccdba8aa94e4129c404afd33ab88c2bcbcc04d12 /macros.h
parent1cc6f587fb5ebb807d48ce3d67783b503fdb4723 (diff)
Created `macros.h`.
This header contains any macros that're widely used throughout the codebase.
Diffstat (limited to 'macros.h')
-rw-r--r--macros.h14
1 files changed, 14 insertions, 0 deletions
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