aboutsummaryrefslogtreecommitdiffstats
path: root/cm-demo.c
diff options
context:
space:
mode:
Diffstat (limited to 'cm-demo.c')
-rw-r--r--cm-demo.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cm-demo.c b/cm-demo.c
index 7a5a3e2..877e662 100644
--- a/cm-demo.c
+++ b/cm-demo.c
@@ -1,8 +1,21 @@
+#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "cheesemap.h"
+_Noreturn void panic_impl(const char* file, uint32_t line, const char* fmt,
+ ...) {
+ fprintf(stderr, "Panic at %s:%u: ", file, line);
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ fprintf(stderr, "\n");
+ abort();
+}
+
// Convenience macro for array length
#define countof(arr) (sizeof(arr) / sizeof(*(arr)))