X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=utils%2Faligned_malloc.h;h=43c9219005524a0b3b9cd8696a2aaf8f00b86c68;hp=819a46cd0af92090a9c5d1726a3ee705a101bd20;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hpb=88cfe534a698a0562e81345957a50714af1453bc diff --git a/utils/aligned_malloc.h b/utils/aligned_malloc.h index 819a46cd..43c92190 100644 --- a/utils/aligned_malloc.h +++ b/utils/aligned_malloc.h @@ -22,18 +22,27 @@ implied warranty. # include #endif -#if _POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 600 +#if defined ANDROID +# include +#endif + +#if (_POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 600) && \ + (!defined ANDROID || __ANDROID_API__ >= 15) +# define ALIGNED_MALLOC_HAS_MEMALIGN 1 +#endif + +#if ALIGNED_MALLOC_HAS_MEMALIGN # define aligned_malloc posix_memalign # define aligned_free free -#else /* old POSIX */ +#else /* !ALIGNED_MALLOC_HAS_MEMALIGN */ /* This can't simply be named posix_memalign, since the real thing uses free(), but this one can't. */ int aligned_malloc(void **ptr, unsigned alignment, size_t size); void aligned_free(void *); -#endif /* old POSIX */ +#endif /* ALIGNED_MALLOC_HAS_MEMALIGN */ #endif /* __ALIGNED_MALLOC_H__ */