[vlc-commits] Fix MacOS compilation (probably)
Rémi Denis-Courmont
git at videolan.org
Thu Mar 1 18:28:48 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Mar 1 19:28:37 2012 +0200| [7222ec271911a579b95ed57b48956787f850e0a7] | committer: Rémi Denis-Courmont
Fix MacOS compilation (probably)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7222ec271911a579b95ed57b48956787f850e0a7
---
compat/posix_memalign.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/compat/posix_memalign.c b/compat/posix_memalign.c
index cd89a0f..b273385 100644
--- a/compat/posix_memalign.c
+++ b/compat/posix_memalign.c
@@ -25,9 +25,6 @@
#include <stdlib.h>
#include <errno.h>
-#ifndef WIN32
-#include <malloc.h>
-
static int check_align (size_t align)
{
for (size_t i = sizeof (void *); i != 0; i *= 2)
@@ -36,6 +33,9 @@ static int check_align (size_t align)
return EINVAL;
}
+#if !defined (WIN32) && !defined (__APPLE__)
+#include <malloc.h>
+
int posix_memalign (void **ptr, size_t align, size_t size)
{
if (check_align (align))
@@ -52,4 +52,16 @@ int posix_memalign (void **ptr, size_t align, size_t size)
*ptr = p;
return 0;
}
+
+#else
+
+int posix_memalign (void **ptr, size_t align, size_t size)
+{
+ if (check_align (align))
+ return EINVAL;
+
+ *ptr = NULL;
+ return size ? ENOMEM : 0;
+}
+
#endif
More information about the vlc-commits
mailing list