This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] malloc: create a useful assert


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]