aboutsummaryrefslogtreecommitdiff
path: root/src/text/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/text/util.h')
-rw-r--r--src/text/util.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/text/util.h b/src/text/util.h
new file mode 100644
index 0000000..bb91383
--- /dev/null
+++ b/src/text/util.h
@@ -0,0 +1,17 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#include <stdio.h> // fprintf()
+
+#define warn(fmt, ...) do { \
+ fprintf(stderr, "W: " fmt "\n", ##__VA_ARGS__); \
+} while (0)
+
+#define die(fmt, ...) do { \
+ fprintf(stderr, "ERROR: " fmt "\n", ##__VA_ARGS__); \
+ exit(EXIT_FAILURE); \
+} while (0)
+
+#define UNUSED(a) ((void) (a))
+
+#endif /* UTIL_H */