diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-01-31 18:29:43 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-01-31 18:29:43 +0000 |
commit | 5350f2b7701f01bc4f234d3971fb8a623a8cd72a (patch) | |
tree | 5f6cd350778863ad8d2612bce4ac2f6270919115 /src/libffmpeg/libavcodec/mem.c | |
parent | 8b0e8647a0d0c279b6a355362452dff4bd6f5c05 (diff) | |
download | xine-lib-5350f2b7701f01bc4f234d3971fb8a623a8cd72a.tar.gz xine-lib-5350f2b7701f01bc4f234d3971fb8a623a8cd72a.tar.bz2 |
update ffmpeg
CVS patchset: 4068
CVS date: 2003/01/31 18:29:43
Diffstat (limited to 'src/libffmpeg/libavcodec/mem.c')
-rw-r--r-- | src/libffmpeg/libavcodec/mem.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/libffmpeg/libavcodec/mem.c b/src/libffmpeg/libavcodec/mem.c index a9b5e0afa..a36952fd7 100644 --- a/src/libffmpeg/libavcodec/mem.c +++ b/src/libffmpeg/libavcodec/mem.c @@ -17,6 +17,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "avcodec.h" + +/* here we can use OS dependant allocation functions */ +#undef malloc +#undef free +#undef realloc + #ifdef HAVE_MALLOC_H #include <malloc.h> #endif @@ -25,10 +31,15 @@ memory allocator. You do not need to suppress this file because the linker will do it automatically */ -/* memory alloc */ +/** + * Memory allocation of size byte with alignment suitable for all + * memory accesses (including vectors if available on the + * CPU). av_malloc(0) must return a non NULL pointer. + */ void *av_malloc(unsigned int size) { void *ptr; + #if defined (HAVE_MEMALIGN) ptr = memalign(16,size); /* Why 64? @@ -60,14 +71,19 @@ void *av_malloc(unsigned int size) #else ptr = malloc(size); #endif - if (!ptr) - return NULL; -//fprintf(stderr, "%X %d\n", (int)ptr, size); - /* NOTE: this memset should not be present */ - memset(ptr, 0, size); return ptr; } +/** + * av_realloc semantics (same as glibc): if ptr is NULL and size > 0, + * identical to malloc(size). If size is zero, it is identical to + * free(ptr) and NULL is returned. + */ +void *av_realloc(void *ptr, unsigned int size) +{ + return realloc(ptr, size); +} + /* NOTE: ptr = NULL is explicetly allowed */ void av_free(void *ptr) { |