From f07580d31d1148c4a1811c36b09ca0ad50d9576b Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Mon, 20 Dec 2021 16:25:43 +0100 Subject: Restructured repository and added automatic make dependency generation --- src/util.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/util.h (limited to 'src/util.h') 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 + +#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); -- cgit v1.2.3-71-gd317