summaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
new file mode 100644
index 0000000..b9f45f4
--- /dev/null
+++ b/src/util.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include <stdio.h>
+
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+#define ARRLEN(x) (sizeof(x)/sizeof((x)[0]))
+
+#define ASSERT(x) assert((x), __FILE__, __LINE__, #x)
+
+int strnwidth(const char *s, int n);
+void assert(int cond, const char *file, int line, const char *condstr);
+
+char *aprintf(const char *fmtstr, ...);
+char *appendstrf(char *alloc, const char *fmtstr, ...);
+
+char *sanitized(const char *instr);
+
+const char *timestr(unsigned int seconds);