aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2009-01-07 23:36:34 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2009-01-07 23:36:34 +0000
commit1f91cdce0b95b9395bd8d085146dcc8b06418614 (patch)
tree05b1995fe1d141182c6a81a543d148432b429b15 /libavutil
parent218a6022e7be21e1f1b78f6f8f06917769e916f4 (diff)
downloadffmpeg-1f91cdce0b95b9395bd8d085146dcc8b06418614.tar.gz
Use posix_memalign() if available.
Originally committed as revision 16488 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/mem.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 960074c70f..328bef787c 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -31,6 +31,7 @@
#undef free
#undef realloc
+#include <stdlib.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
@@ -41,7 +42,7 @@
void *av_malloc(unsigned int size)
{
- void *ptr;
+ void *ptr = NULL;
#ifdef CONFIG_MEMALIGN_HACK
long diff;
#endif
@@ -57,6 +58,8 @@ void *av_malloc(unsigned int size)
diff= ((-(long)ptr - 1)&15) + 1;
ptr = (char*)ptr + diff;
((char*)ptr)[-1]= diff;
+#elif defined (HAVE_POSIX_MEMALIGN)
+ posix_memalign(&ptr,16,size);
#elif defined (HAVE_MEMALIGN)
ptr = memalign(16,size);
/* Why 64?