changeset 9254:d6fcb6d050ba HEAD

Don't include malloc.h if it doesn't have malloc_usable_size().
author Timo Sirainen <tss@iki.fi>
date Sun, 26 Jul 2009 20:13:18 -0400
parents 45b110c8da62
children 1aec43edab2d
files src/lib/mempool-system-clean.c src/lib/mempool-system.c
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/mempool-system-clean.c	Sun Jul 26 20:01:44 2009 -0400
+++ b/src/lib/mempool-system-clean.c	Sun Jul 26 20:13:18 2009 -0400
@@ -6,13 +6,14 @@
 #include "safe-memset.h"
 #include "mempool.h"
 
-#ifdef HAVE_MALLOC_H
-#  include <malloc.h>
+#include <stdlib.h>
+#ifndef HAVE_MALLOC_USABLE_SIZE
+/* no extra includes needed */
+#elif defined (HAVE_MALLOC_NP_H)
+#  include <malloc_np.h> /* FreeBSD */
+#elif defined (HAVE_MALLOC_H)
+#  include <malloc.h> /* Linux */
 #endif
-#ifdef HAVE_MALLOC_NP_H
-#  include <malloc_np.h> /* for malloc_usable_size() with FreeBSD */
-#endif
-#include <stdlib.h>
 
 #ifdef HAVE_GC_GC_H
 #  include <gc/gc.h>
--- a/src/lib/mempool-system.c	Sun Jul 26 20:01:44 2009 -0400
+++ b/src/lib/mempool-system.c	Sun Jul 26 20:13:18 2009 -0400
@@ -6,11 +6,12 @@
 #include "mempool.h"
 
 #include <stdlib.h>
-#ifdef HAVE_MALLOC_H
-#  include <malloc.h>
-#endif
-#ifdef HAVE_MALLOC_NP_H
-#  include <malloc_np.h> /* for malloc_usable_size() with FreeBSD */
+#ifndef HAVE_MALLOC_USABLE_SIZE
+/* no extra includes needed */
+#elif defined (HAVE_MALLOC_NP_H)
+#  include <malloc_np.h> /* FreeBSD */
+#elif defined (HAVE_MALLOC_H)
+#  include <malloc.h> /* Linux */
 #endif
 
 #ifdef HAVE_GC_GC_H