]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
Change the logic in bind.c to only include <malloc.h> if we don't have posix_memalign.
authorJeff Squyres <jsquyres@cisco.com>
Fri, 10 Jan 2014 17:05:48 +0000 (09:05 -0800)
committerJeff Squyres <jsquyres@cisco.com>
Fri, 10 Jan 2014 17:05:48 +0000 (09:05 -0800)
In http://www.open-mpi.org/community/lists/devel/2014/01/13619.php,
Paul Hargrove found a compiler warning on OpenBSD where <malloc.h>
exists, but is not intended to be used (and doesn't error out, so
AC_CHECK_HEADERS says its ok).

src/bind.c

index 046b7cf1b0e98dde8794f5fceee853fb4388cd2e..37921bcee1ee7dbc9fee8e1ae9990a250141c093 100644 (file)
@@ -13,8 +13,9 @@
 #ifdef HAVE_SYS_MMAN_H
 #  include <sys/mman.h>
 #endif
-#ifdef HAVE_MALLOC_H
-#  include <malloc.h>
+/* <malloc.h> is only needed if we don't have posix_memalign() */
+#if defined(hwloc_getpagesize) && !defined(HAVE_POSIX_MEMALIGN) && defined(HAVE_MEMALIGN) && defined(HAVE_MALLOC_H)
+#include <malloc.h>
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>