[Ffmpeg-cvslog] r5992 - trunk/libavutil/mem.c
michael
subversion
Sun Aug 13 02:47:16 CEST 2006
Author: michael
Date: Sun Aug 13 02:47:16 2006
New Revision: 5992
Modified:
trunk/libavutil/mem.c
Log:
align av_realloc()
Modified: trunk/libavutil/mem.c
==============================================================================
--- trunk/libavutil/mem.c (original)
+++ trunk/libavutil/mem.c Sun Aug 13 02:47:16 2006
@@ -101,22 +101,24 @@
*/
void *av_realloc(void *ptr, unsigned int size)
{
-#ifdef MEMALIGN_HACK
- int diff;
-#endif
+ void *ptr2;
/* let's disallow possible ambiguous cases */
if(size > (INT_MAX-16) )
return NULL;
-#ifdef MEMALIGN_HACK
- //FIXME this isn't aligned correctly, though it probably isn't needed
- if(!ptr) return av_malloc(size);
- diff= ((char*)ptr)[-1];
- return realloc(ptr - diff, size + diff) + diff;
-#else
- return realloc(ptr, size);
+#ifndef MEMALIGN_HACK
+ ptr= realloc(ptr, size);
+ if(((int)ptr&15) || !ptr)
+ return ptr;
#endif
+
+ ptr2= av_malloc(size);
+ if(ptr && ptr2)
+ memcpy(ptr2, ptr, size);
+ av_free(ptr);
+
+ return ptr2;
}
/**
More information about the ffmpeg-cvslog
mailing list