diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-11 23:58:39 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-13 02:41:43 +0200 |
commit | d6ff68ad853cab83cb58905b33a3957d249a75dd (patch) | |
tree | 1fafcba3ded3d44f8589d6b26a86f09fe92cc528 /libavcodec | |
parent | 03931ecf71710452fc9e89d4f18354f0b5e05395 (diff) |
Factor duplicated ff_fast_malloc() out into mem_internal.h
internal.h is difficult to use due to circular dependancies
mem.h is a public header ff_* is not public
Alternative solutions probably are possible too
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index fb5a72f14f..f34490312d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -36,6 +36,7 @@ #include "libavutil/frame.h" #include "libavutil/internal.h" #include "libavutil/mathematics.h" +#include "libavutil/mem_internal.h" #include "libavutil/pixdesc.h" #include "libavutil/imgutils.h" #include "libavutil/samplefmt.h" @@ -122,25 +123,6 @@ static int volatile entangled_thread_counter = 0; static void *codec_mutex; static void *avformat_mutex; -static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc) -{ - void *val; - - memcpy(&val, ptr, sizeof(val)); - if (min_size <= *size) { - av_assert0(val || !min_size); - return 0; - } - min_size = FFMAX(min_size + min_size / 16 + 32, min_size); - av_freep(ptr); - val = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size); - memcpy(ptr, &val, sizeof(val)); - if (!val) - min_size = 0; - *size = min_size; - return 1; -} - void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size) { uint8_t **p = ptr; |