From 439bda3209b768c349b98b8ceecf0fa8d94600e9 Mon Sep 17 00:00:00 2001 From: Will Newton Date: Mon, 31 Mar 2014 15:00:32 +0100 Subject: 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 * 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. --- ChangeLog | 6 ++++++ malloc/malloc.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fb0177d554..e7e358385b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-04-11 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. + 2014-04-10 Torvald Riegel * benchtests/pthread_once-inputs: New file. diff --git a/malloc/malloc.c b/malloc/malloc.c index 9a45707ee7..1120d4df84 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); -- cgit 1.4.1