This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: create a useful assert
- From: Joern Engel <joern at purestorage dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Cc: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>, Joern Engel <joern at purestorage dot org>
- Date: Mon, 25 Jan 2016 16:25:05 -0800
- Subject: [PATCH] malloc: create a useful assert
- Authentication-results: sourceware.org; auth=none
- References: <1453767942-19369-1-git-send-email-joern at purestorage dot com>
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 --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)) { ; }
--
2.7.0.rc3