This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED PATCH] Add missing #include for malloc/hooks.c code.
- From: Roland McGrath <roland at hack dot frob dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Thu, 21 Nov 2013 15:53:09 -0800 (PST)
- Subject: [COMMITTED PATCH] Add missing #include for malloc/hooks.c code.
- Authentication-results: sourceware.org; auth=none
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)