diff mbox

malloc: create a useful assert

Message ID 1453767942-19369-27-git-send-email-joern@purestorage.com
State New
Headers show

Commit Message

Jörn Engel Jan. 26, 2016, 12:25 a.m. UTC
From: Joern Engel <joern@purestorage.org>

No idea why including <assert.h> doesn't do the job.

JIRA: PURE-27597
---
 tpc/malloc2.13/malloc.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox

Patch

diff --git a/tpc/malloc2.13/malloc.c b/tpc/malloc2.13/malloc.c
index 83d2c4c02e48..dca97ef553c0 100644
--- a/tpc/malloc2.13/malloc.c
+++ b/tpc/malloc2.13/malloc.c
@@ -313,7 +313,14 @@  extern "C" {
 */
 
 #if MALLOC_DEBUG
+# ifdef PURE_HACK
+#undef  assert
+#define assert(x) if (!(x)) { \
+	fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, __STRING(x)); \
+	abort(); }
+# else
 #include <assert.h>
+# endif
 #else
 #undef  assert
 #define assert(x) if (0 && !(x)) { ; }