[syslinux:master] core: dprintf on malloc/free if -DDEBUG_MALLOC

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Fri Sep 4 09:15:03 PDT 2015

Commit-ID:  8f17572be0a5a572f94bd476811087f634c26de6
Gitweb:     http://www.syslinux.org/commit/8f17572be0a5a572f94bd476811087f634c26de6
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Fri, 14 Aug 2015 07:35:21 +0200
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Wed, 2 Sep 2015 21:30:35 +0200

core: dprintf on malloc/free if -DDEBUG_MALLOC

When dynamic debug is engaged, the output is pretty flooded by
malloc/free messages while you are looking at other traces.

As devel.mk have a DEBUG_MALLOC option, it seems pretty logical to
enable the malloc/free dprintf() only if this option is engaged.

That patch make the dynamic debug output less floody while letting the
choice to get the malloc/free dprintf() messages.

 core/mem/free.c   | 2 ++
 core/mem/malloc.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/core/mem/free.c b/core/mem/free.c
index 2d16cd1..21f9b59 100644
--- a/core/mem/free.c
+++ b/core/mem/free.c
@@ -87,7 +87,9 @@ void bios_free(void *ptr)
 __export void free(void *ptr)
     dprintf("free(%p) @ %p\n", ptr, __builtin_return_address(0));
     if ( !ptr )
diff --git a/core/mem/malloc.c b/core/mem/malloc.c
index b40c2f2..836c2fe 100644
--- a/core/mem/malloc.c
+++ b/core/mem/malloc.c
@@ -93,14 +93,18 @@ static void *_malloc(size_t size, enum heap heap, malloc_tag_t tag)
     void *p;
     dprintf("_malloc(%zu, %u, %u) @ %p = ",
 	size, heap, tag, __builtin_return_address(0));
     sem_down(&__malloc_semaphore, 0);
     p = firmware->mem->malloc(size, heap, tag);
     dprintf("%p\n", p);
     return p;

More information about the Syslinux-commits mailing list