Blob Blame History Raw
commit 439bda3209b768c349b98b8ceecf0fa8d94600e9
Author: Will Newton <will.newton@linaro.org>
Date:   Mon Mar 31 15:00:32 2014 +0100

    malloc: Fix MALLOC_DEBUG -Wundef warning
    
    MALLOC_DEBUG is set optionally on the command line. Default the value
    to zero if it is not set on the command line, and test its value
    with #if rather than #ifdef. Verified the code is identical before
    and after this change apart from line numbers.
    
    ChangeLog:
    
    2014-04-11  Will Newton  <will.newton@linaro.org>
    
            * malloc/malloc.c [!MALLOC_DEBUG]: #define MALLOC_DEBUG
            to zero if it is not defined elsewhere.  (mtrim): Test
            the value of MALLOC_DEBUG with #if rather than #ifdef.

Conflicts:
	malloc/malloc.c

Resolve whitespace conflict due to malloc reformatting in upstream
commit 6c8dbf00f536d78b1937b5af6f57be47fd376344.

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 9d3b24ee0c137a1b..3e7b9bf9e8d71247 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -267,6 +267,10 @@
   or other mallocs available that do this.
 */
 
+#ifndef MALLOC_DEBUG
+#define MALLOC_DEBUG 0
+#endif
+
 #ifdef NDEBUG
 # define assert(expr) ((void) 0)
 #else
@@ -4520,7 +4524,7 @@ static int mtrim(mstate av, size_t pad)
 
 		if (size > psm1)
 		  {
-#ifdef MALLOC_DEBUG
+#if MALLOC_DEBUG
 		    /* When debugging we simulate destroying the memory
 		       content.  */
 		    memset (paligned_mem, 0x89, size & ~psm1);