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
This commit is contained in:
parent
e9ca315dd1
commit
4ae406856f
9
configure
vendored
9
configure
vendored
@ -231,6 +231,7 @@ Advanced options (experts only):
|
|||||||
--disable-vis disable VIS optimizations
|
--disable-vis disable VIS optimizations
|
||||||
--disable-yasm disable use of yasm assembler
|
--disable-yasm disable use of yasm assembler
|
||||||
--enable-pic build position-independent code
|
--enable-pic build position-independent code
|
||||||
|
--malloc-prefix=PFX prefix malloc and related names with PFX
|
||||||
|
|
||||||
Developer options (useful when working on FFmpeg itself):
|
Developer options (useful when working on FFmpeg itself):
|
||||||
--disable-debug disable debugging symbols
|
--disable-debug disable debugging symbols
|
||||||
@ -1108,6 +1109,7 @@ CMDLINE_SET="
|
|||||||
host_os
|
host_os
|
||||||
ld
|
ld
|
||||||
logfile
|
logfile
|
||||||
|
malloc_prefix
|
||||||
nm
|
nm
|
||||||
source_path
|
source_path
|
||||||
sysinclude
|
sysinclude
|
||||||
@ -2438,9 +2440,9 @@ check_func gethrtime
|
|||||||
check_func getrusage
|
check_func getrusage
|
||||||
check_func inet_aton $network_extralibs
|
check_func inet_aton $network_extralibs
|
||||||
check_func isatty
|
check_func isatty
|
||||||
check_func memalign
|
check_func ${malloc_prefix}memalign && enable memalign
|
||||||
check_func mkstemp
|
check_func mkstemp
|
||||||
check_func posix_memalign
|
check_func ${malloc_prefix}posix_memalign && enable posix_memalign
|
||||||
check_func_headers io.h setmode
|
check_func_headers io.h setmode
|
||||||
check_func_headers lzo/lzo1x.h lzo1x_999_compress
|
check_func_headers lzo/lzo1x.h lzo1x_999_compress
|
||||||
check_func_headers windows.h GetProcessTimes
|
check_func_headers windows.h GetProcessTimes
|
||||||
@ -2978,6 +2980,9 @@ cat > $TMPH <<EOF
|
|||||||
#define EXTERN_ASM ${extern_prefix}
|
#define EXTERN_ASM ${extern_prefix}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
test -n "$malloc_prefix" &&
|
||||||
|
echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
|
||||||
|
|
||||||
if enabled small || disabled optimizations; then
|
if enabled small || disabled optimizations; then
|
||||||
echo "#define av_always_inline" >> $TMPH
|
echo "#define av_always_inline" >> $TMPH
|
||||||
fi
|
fi
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "avutil.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
/* here we can use OS-dependent allocation functions */
|
/* here we can use OS-dependent allocation functions */
|
||||||
@ -40,6 +41,22 @@
|
|||||||
#undef malloc
|
#undef malloc
|
||||||
#undef realloc
|
#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
|
/* 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
|
memory allocator. You do not need to suppress this file because the
|
||||||
linker will do it automatically. */
|
linker will do it automatically. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user