From 255425381df514f6bb0dbb43fe6119c4e918113f Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Mon, 6 Sep 2010 08:19:57 +0300 Subject: [PATCH] base: don't define posix_memalign, if it cannot be emulated --- usual/base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usual/base.c b/usual/base.c index ed45156..9489d9f 100644 --- a/usual/base.c +++ b/usual/base.c @@ -22,7 +22,10 @@ #include #endif -#ifndef HAVE_POSIX_MEMALIGN +/* define posix_memalign() only when possible to emulate */ +#if !defined(HAVE_POSIX_MEMALIGN) \ + && (defined(HAVE_MEMALIGN) || defined(HAVE_VALLOC)) + int posix_memalign(void **ptr_p, size_t align, size_t len) { void *p; @@ -34,9 +37,6 @@ int posix_memalign(void **ptr_p, size_t align, size_t len) #ifdef HAVE_VALLOC /* assuming less than pagesize alignment */ p = valloc(len); -#else /* !VALLOC */ - #warning "cannot emulate posix_memalign sanely" - p = malloc(len); #endif /* !VALLOC */ #endif /* !MEMALIGN */ -- 2.39.5