diff options
author | Nick Kurshev <nickols_k@mail.ru> | 2001-09-13 07:16:59 +0000 |
---|---|---|
committer | Nick Kurshev <nickols_k@mail.ru> | 2001-09-13 07:16:59 +0000 |
commit | 3d2043852d1533c79154c21c7a5f8bb453fa6e63 (patch) | |
tree | e049d288b3dd0d6c59c063dd8f81e0aa1d6066dc /libavcodec | |
parent | 544286b3d39365b30298ae07e66a755200b0895c (diff) | |
download | ffmpeg-3d2043852d1533c79154c21c7a5f8bb453fa6e63.tar.gz |
memalign autodetection
Originally committed as revision 115 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f1253abfd9..78e12469e6 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -16,37 +16,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> -#include <limits.h> /* __GLIBC__ and __GLIBC_MINOR__ are defined here */ -#if __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1 /* Fixme about glibc-2.0 */ -#define HAVE_MEMALIGN 1 -#include <malloc.h> -#endif #include "common.h" #include "dsputil.h" #include "avcodec.h" +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#else +#include <stdlib.h> +#endif /* memory alloc */ void *av_mallocz(int size) { void *ptr; #if defined ( ARCH_X86 ) && defined ( HAVE_MEMALIGN ) -/* - From glibc-2.1.x manuals: - ------------------------- - The address of a block returned by `malloc' or `realloc' in the GNU -system is always a multiple of eight (or sixteen on 64-bit systems). -If you need a block whose address is a multiple of a higher power of -two than that, use `memalign' or `valloc'. These functions are -declared in `stdlib.h'. - - With the GNU library, you can use `free' to free the blocks that -`memalign' and `valloc' return. That does not work in BSD, -however--BSD does not provide any way to free such blocks. -*/ ptr = memalign(64,size); /* Why 64? Indeed, we should align it: |