[COMMITTED PATCH] Add missing #include for malloc/hooks.c code.

Roland McGrath roland@hack.frob.com
Sat Nov 23 23:25:00 GMT 2013


I didn't notice when this got broken (in the last month or two).  Probably
all the Linux configurations indirectly include <sys/param.h> early on for
some reason.  It's needed before the inclusion of hooks.c because that uses
the powerof2 macro.

In general, it's always dubious practice to put a header inclusion in the
middle of a file rather than at the top.


Thanks,
Roland


2013-11-21  Roland McGrath  <roland@hack.frob.com>

	* malloc/malloc.c: Move #include <sys/param.h> to the top; comment why
	it's there.

--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -238,6 +238,9 @@
 /* For va_arg, va_start, va_end.  */
 #include <stdarg.h>
 
+/* For MIN, MAX, powerof2.  */
+#include <sys/param.h>
+
 
 /*
   Debugging:
@@ -4875,8 +4878,6 @@ malloc_printerr(int action, const char *str, void *ptr)
     abort ();
 }
 
-#include <sys/param.h>
-
 /* We need a wrapper function for one of the additions of POSIX.  */
 int
 __posix_memalign (void **memptr, size_t alignment, size_t size)



More information about the Libc-alpha mailing list