diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-04-27 19:15:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 19:15:26 +0200 |
commit | c75dae3ed21bfa5a8ae46cd83d18329af5bea05a (patch) | |
tree | ef657c38feb2368a3c86765778d1f068aa5eb614 /media/ffvpx/libavutil/mem.c | |
parent | c82c6d960a7f19d6595171f9705c43514f20c1ec (diff) | |
parent | 6ada4b14e4cfc91f5f1b2556623cab691f3ab813 (diff) | |
download | UXP-c75dae3ed21bfa5a8ae46cd83d18329af5bea05a.tar UXP-c75dae3ed21bfa5a8ae46cd83d18329af5bea05a.tar.gz UXP-c75dae3ed21bfa5a8ae46cd83d18329af5bea05a.tar.lz UXP-c75dae3ed21bfa5a8ae46cd83d18329af5bea05a.tar.xz UXP-c75dae3ed21bfa5a8ae46cd83d18329af5bea05a.zip |
Merge pull request #275 from trav90/ffvpx-resync
Resync ffvpx code with 3.4.2-release from upstream
Diffstat (limited to 'media/ffvpx/libavutil/mem.c')
-rw-r--r-- | media/ffvpx/libavutil/mem.c | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/media/ffvpx/libavutil/mem.c b/media/ffvpx/libavutil/mem.c index 1a8fc21e9..36740f115 100644 --- a/media/ffvpx/libavutil/mem.c +++ b/media/ffvpx/libavutil/mem.c @@ -77,22 +77,12 @@ void av_max_alloc(size_t max){ void *av_malloc(size_t size) { void *ptr = NULL; -#if CONFIG_MEMALIGN_HACK - long diff; -#endif /* let's disallow possibly ambiguous cases */ if (size > (max_alloc_size - 32)) return NULL; -#if CONFIG_MEMALIGN_HACK - ptr = malloc(size + ALIGN); - if (!ptr) - return ptr; - diff = ((~(long)ptr)&(ALIGN - 1)) + 1; - ptr = (char *)ptr + diff; - ((char *)ptr)[-1] = diff; -#elif HAVE_POSIX_MEMALIGN +#if HAVE_POSIX_MEMALIGN if (size) //OS X on SDK 10.6 has a broken posix_memalign implementation if (posix_memalign(&ptr, ALIGN, size)) ptr = NULL; @@ -144,25 +134,11 @@ void *av_malloc(size_t size) void *av_realloc(void *ptr, size_t size) { -#if CONFIG_MEMALIGN_HACK - int diff; -#endif - /* let's disallow possibly ambiguous cases */ if (size > (max_alloc_size - 32)) return NULL; -#if CONFIG_MEMALIGN_HACK - //FIXME this isn't aligned correctly, though it probably isn't needed - if (!ptr) - return av_malloc(size); - diff = ((char *)ptr)[-1]; - av_assert0(diff>0 && diff<=ALIGN); - ptr = realloc((char *)ptr - diff, size + diff); - if (ptr) - ptr = (char *)ptr + diff; - return ptr; -#elif HAVE_ALIGNED_MALLOC +#if HAVE_ALIGNED_MALLOC return _aligned_realloc(ptr, size + !size, ALIGN); #else return realloc(ptr, size + !size); @@ -227,13 +203,7 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size) void av_free(void *ptr) { -#if CONFIG_MEMALIGN_HACK - if (ptr) { - int v= ((char *)ptr)[-1]; - av_assert0(v>0 && v<=ALIGN); - free((char *)ptr - v); - } -#elif HAVE_ALIGNED_MALLOC +#if HAVE_ALIGNED_MALLOC _aligned_free(ptr); #else free(ptr); |