aboutsummaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-07 23:22:43 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-07 23:22:43 -0700
commitf7cdd6d4d2c492683f0b5f65fa2fe788772df7c8 (patch)
tree75e7ab9b26a38c3ca7ba4337ec4bc991e8a9d2fa /utils.h
parentcead7e5b2626e80f826236320e63f2e8570e7fb6 (diff)
Cleanup, splitting into files
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils.h b/utils.h
new file mode 100644
index 0000000..8723516
--- /dev/null
+++ b/utils.h
@@ -0,0 +1,7 @@
+/*
+ * utils.h - Some helper code for debugging and error logging.
+ */
+
+// TODO: better error reporting
+#define check(cond, ...) do { if (!(cond)) { fprintf(stderr, __VA_ARGS__); fwrite("\n", 1, 1, stderr); _exit(1); } } while(0)
+#define debug(...) do { if (verbose) fprintf(stderr, __VA_ARGS__); } while(0)