summaryrefslogtreecommitdiff
path: root/base.h
diff options
context:
space:
mode:
Diffstat (limited to 'base.h')
-rw-r--r--base.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/base.h b/base.h
index 92270bc..8327fdb 100644
--- a/base.h
+++ b/base.h
@@ -1,6 +1,10 @@
#ifndef BASE_H_
#define BASE_H_
+#ifndef DEBUG
+#define NDEBUG 1
+#endif
+
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -34,4 +38,22 @@ typedef unsigned long ulong;
#define no_warn_end
#endif
+#if DEBUG
+#if __unix__
+#define debug_println printf
+#else // __unix__
+static void debug_println(char const *fmt, ...) {
+ char buf[256];
+ va_list args;
+ va_start(args, fmt);
+ vsprintf_s(buf, sizeof buf, fmt, args);
+ va_end(args);
+ OutputDebugStringA(buf);
+ OutputDebugStringA("\n");
+}
+#endif // __unix__
+#else // DEBUG
+#define debug_println(...)
+#endif
+
#endif