From patchwork Mon Mar 31 15:04:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: malloc: Fix MALLOC_DEBUG -Wundef warning X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 27422 Message-Id: <1396278243-24455-1-git-send-email-will.newton@linaro.org> To: libc-alpha@sourceware.org Date: Mon, 31 Mar 2014 16:04:03 +0100 From: Will Newton List-Id: 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-03-31 Will Newton * 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. --- malloc/malloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/malloc/malloc.c b/malloc/malloc.c index 9a45707..1120d4d 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -270,6 +270,10 @@ or other mallocs available that do this. */ +#ifndef MALLOC_DEBUG +#define MALLOC_DEBUG 0 +#endif + #ifdef NDEBUG # define assert(expr) ((void) 0) #else @@ -4477,7 +4481,7 @@ 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);