aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mem.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2009-01-13 23:44:16 +0000
committerAurelien Jacobs <aurel@gnuage.org>2009-01-13 23:44:16 +0000
commitb250f9c66d3ddd84652d158fb979a5f21e3f2c71 (patch)
treeef84366029d6f8af6ed82e90c5f188bb7dfc844d /libavutil/mem.c
parent959da985b03570cfe7d239c0ba6d550ecb04c460 (diff)
downloadffmpeg-b250f9c66d3ddd84652d158fb979a5f21e3f2c71.tar.gz
Change semantic of CONFIG_*, HAVE_* and ARCH_*.
They are now always defined to either 0 or 1. Originally committed as revision 16590 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/mem.c')
-rw-r--r--libavutil/mem.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 328bef787c..95299a1c0b 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -32,7 +32,7 @@
#undef realloc
#include <stdlib.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
@@ -43,7 +43,7 @@
void *av_malloc(unsigned int size)
{
void *ptr = NULL;
-#ifdef CONFIG_MEMALIGN_HACK
+#if CONFIG_MEMALIGN_HACK
long diff;
#endif
@@ -51,16 +51,16 @@ void *av_malloc(unsigned int size)
if(size > (INT_MAX-16) )
return NULL;
-#ifdef CONFIG_MEMALIGN_HACK
+#if CONFIG_MEMALIGN_HACK
ptr = malloc(size+16);
if(!ptr)
return ptr;
diff= ((-(long)ptr - 1)&15) + 1;
ptr = (char*)ptr + diff;
((char*)ptr)[-1]= diff;
-#elif defined (HAVE_POSIX_MEMALIGN)
+#elif HAVE_POSIX_MEMALIGN
posix_memalign(&ptr,16,size);
-#elif defined (HAVE_MEMALIGN)
+#elif HAVE_MEMALIGN
ptr = memalign(16,size);
/* Why 64?
Indeed, we should align it:
@@ -96,7 +96,7 @@ void *av_malloc(unsigned int size)
void *av_realloc(void *ptr, unsigned int size)
{
-#ifdef CONFIG_MEMALIGN_HACK
+#if CONFIG_MEMALIGN_HACK
int diff;
#endif
@@ -104,7 +104,7 @@ void *av_realloc(void *ptr, unsigned int size)
if(size > (INT_MAX-16) )
return NULL;
-#ifdef CONFIG_MEMALIGN_HACK
+#if CONFIG_MEMALIGN_HACK
//FIXME this isn't aligned correctly, though it probably isn't needed
if(!ptr) return av_malloc(size);
diff= ((char*)ptr)[-1];
@@ -118,7 +118,7 @@ void av_free(void *ptr)
{
/* XXX: this test should not be needed on most libcs */
if (ptr)
-#ifdef CONFIG_MEMALIGN_HACK
+#if CONFIG_MEMALIGN_HACK
free((char*)ptr - ((char*)ptr)[-1]);
#else
free(ptr);