summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-10-27 22:21:59 +0100
committerAnton Khirnov <anton@khirnov.net>2013-11-14 09:42:22 +0100
commitcce3e0a49f0dd030262c28d9c53de0bd2fd909c4 (patch)
tree8976499166d5a5d4425ed647d139e4c5c4604ccf /libavcodec/utils.c
parentaa241229891173b0357eee04e6ca78f806cc9c0c (diff)
Move av_fast_{m,re}alloc from lavc to lavu.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2f5c170c69..23165f4f43 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -55,37 +55,17 @@ static int (*lockmgr_cb)(void **mutex, enum AVLockOp op);
static void *codec_mutex;
static void *avformat_mutex;
-void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
+#if FF_API_FAST_MALLOC && CONFIG_SHARED && HAVE_SYMVER
+FF_SYMVER(void*, av_fast_realloc, (void *ptr, unsigned int *size, size_t min_size), "LIBAVCODEC_55")
{
- if (min_size < *size)
- return ptr;
-
- min_size = FFMAX(17 * min_size / 16 + 32, min_size);
-
- ptr = av_realloc(ptr, min_size);
- /* we could set this to the unmodified min_size but this is safer
- * if the user lost the ptr and uses NULL now
- */
- if (!ptr)
- min_size = 0;
-
- *size = min_size;
-
- return ptr;
+ return av_fast_realloc(ptr, size, min_size);
}
-void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
+FF_SYMVER(void, av_fast_malloc, (void *ptr, unsigned int *size, size_t min_size), "LIBAVCODEC_55")
{
- void **p = ptr;
- if (min_size < *size)
- return;
- min_size = FFMAX(17 * min_size / 16 + 32, min_size);
- av_free(*p);
- *p = av_malloc(min_size);
- if (!*p)
- min_size = 0;
- *size = min_size;
+ av_fast_malloc(ptr, size, min_size);
}
+#endif
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
{