summaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-02-21 12:44:44 +0000
committerJose Fonseca <jfonseca@vmware.com>2015-02-21 12:46:17 +0000
commit12450a46046a42a3a8d627612e9f0f31ee9c3001 (patch)
tree7e2cf5dc59c1637348a9eb8b3f11da54579591fd /tests/util
parente1482193d82b41b461fa77d6ceab86087d432160 (diff)
util: Fix MacOSX build.
Mac OS X only supports posix_memalign, not aligned_alloc.
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/piglit-util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 22e630719..4c5e3895a 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -829,6 +829,12 @@ piglit_alloc_aligned(size_t size, size_t alignment)
{
#if defined(_WIN32)
return _aligned_malloc(size, alignment);
+#elif defined(__APPLE__)
+ void *p;
+ if (posix_memalign(&p, alignment, size) != 0) {
+ return NULL;
+ }
+ return p;
#else
return aligned_alloc(alignment, size);
#endif