c6d234
commit 439bda3209b768c349b98b8ceecf0fa8d94600e9
c6d234
Author: Will Newton <will.newton@linaro.org>
c6d234
Date:   Mon Mar 31 15:00:32 2014 +0100
c6d234
c6d234
    malloc: Fix MALLOC_DEBUG -Wundef warning
c6d234
    
c6d234
    MALLOC_DEBUG is set optionally on the command line. Default the value
c6d234
    to zero if it is not set on the command line, and test its value
c6d234
    with #if rather than #ifdef. Verified the code is identical before
c6d234
    and after this change apart from line numbers.
c6d234
    
c6d234
    ChangeLog:
c6d234
    
c6d234
    2014-04-11  Will Newton  <will.newton@linaro.org>
c6d234
    
c6d234
            * malloc/malloc.c [!MALLOC_DEBUG]: #define MALLOC_DEBUG
c6d234
            to zero if it is not defined elsewhere.  (mtrim): Test
c6d234
            the value of MALLOC_DEBUG with #if rather than #ifdef.
c6d234
c6d234
Conflicts:
c6d234
	malloc/malloc.c
c6d234
c6d234
Resolve whitespace conflict due to malloc reformatting in upstream
c6d234
commit 6c8dbf00f536d78b1937b5af6f57be47fd376344.
c6d234
c6d234
diff --git a/malloc/malloc.c b/malloc/malloc.c
c6d234
index 9d3b24ee0c137a1b..3e7b9bf9e8d71247 100644
c6d234
--- a/malloc/malloc.c
c6d234
+++ b/malloc/malloc.c
c6d234
@@ -267,6 +267,10 @@
c6d234
   or other mallocs available that do this.
c6d234
 */
c6d234
 
c6d234
+#ifndef MALLOC_DEBUG
c6d234
+#define MALLOC_DEBUG 0
c6d234
+#endif
c6d234
+
c6d234
 #ifdef NDEBUG
c6d234
 # define assert(expr) ((void) 0)
c6d234
 #else
c6d234
@@ -4520,7 +4524,7 @@ static int mtrim(mstate av, size_t pad)
c6d234
 
c6d234
 		if (size > psm1)
c6d234
 		  {
c6d234
-#ifdef MALLOC_DEBUG
c6d234
+#if MALLOC_DEBUG
c6d234
 		    /* When debugging we simulate destroying the memory
c6d234
 		       content.  */
c6d234
 		    memset (paligned_mem, 0x89, size & ~psm1);