From f60dc971069e7d4ceade8a1be52b4d42b69828df Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 2 May 2012 16:10:51 -0700 Subject: [PATCH] common: add ASSERT() --- common.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common.h b/common.h index d4823dbf..3476f537 100644 --- a/common.h +++ b/common.h @@ -15,6 +15,15 @@ #define DBG_ENABLED() (0) #endif +#define ASSERT(expr) \ +do { \ + if (!(expr)) { \ + fprintf(stderr, "Error: assertion failed in %s at line %d\n", __FILE__, __LINE__); \ + exit(1); \ + } \ +} while (0); + + void * myMalloc(size_t size); void myFree(void *ptr); -- 2.34.1