about summary refs log tree commit diff stats
path: root/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index 6d19477..93d101f 100644
--- a/src/common.h
+++ b/src/common.h
@@ -1,9 +1,21 @@
 #ifndef SRC_COMMON_H_
 #define SRC_COMMON_H_
 
+#include <stdio.h>
+#include <stdlib.h>
+
 #include "uv_link_t.h"
 
 #define container_of(ptr, type, member) \
   ((type *) ((char *) (ptr) - offsetof(type, member)))
 
+#define CHECK(VALUE, MESSAGE)                                                \
+    do {                                                                     \
+      if ((VALUE)) break;                                                    \
+      fprintf(stderr, "Assertion failure: " #MESSAGE "\n");                  \
+    } while (0);
+
+#define CHECK_EQ(A, B, MESSAGE) CHECK((A) == (B), MESSAGE)
+#define CHECK_NE(A, B, MESSAGE) CHECK((A) != (B), MESSAGE)
+
 #endif  /* SRC_COMMON_H_ */