aboutsummaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..9ed7cd9
--- /dev/null
+++ b/util.h
@@ -0,0 +1,19 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+void error_exit(char *fmt, ...);
+
+#define ERROR_EXIT(fmt, x...) \
+ do { \
+ error_exit(fmt, ## x); \
+ } while (0)
+
+#define ERROR_EXIT_ON(check, fmt, x...) \
+ do { \
+ if (check) \
+ error_exit(fmt, ## x); \
+ } while (0)
+
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x)))
+
+#endif