diff options
author | Måns Rullgård <mans@mansr.com> | 2010-01-28 13:06:31 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2010-01-28 13:06:31 +0000 |
commit | 4ae406856f5cebe02f2c9ce85719c392bbc2d9bb (patch) | |
tree | 62ac476a827ff979b4eb9810e667edc239b2ea21 /libavutil | |
parent | e9ca315dd188c38621c9439ef813d1cdf846ce1d (diff) | |
download | ffmpeg-4ae406856f5cebe02f2c9ce85719c392bbc2d9bb.tar.gz |
Add --malloc-prefix to apply a prefix to malloc, free etc
This makes it easy to use a replacement allocator instead of the
system default one.
Originally committed as revision 21509 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/mem.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c index 741450b53f..4d776d4450 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -33,6 +33,7 @@ #include <malloc.h> #endif +#include "avutil.h" #include "mem.h" /* here we can use OS-dependent allocation functions */ @@ -40,6 +41,22 @@ #undef malloc #undef realloc +#ifdef MALLOC_PREFIX + +#define malloc AV_JOIN(MALLOC_PREFIX, malloc) +#define memalign AV_JOIN(MALLOC_PREFIX, memalign) +#define posix_memalign AV_JOIN(MALLOC_PREFIX, posix_memalign) +#define realloc AV_JOIN(MALLOC_PREFIX, realloc) +#define free AV_JOIN(MALLOC_PREFIX, free) + +void *malloc(size_t size); +void *memalign(size_t align, size_t size); +int posix_memalign(void **ptr, size_t align, size_t size); +void *realloc(void *ptr, size_t size); +void free(void *ptr); + +#endif /* MALLOC_PREFIX */ + /* You can redefine av_malloc and av_free in your project to use your memory allocator. You do not need to suppress this file because the linker will do it automatically. */ |