summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2016-03-24 20:55:19 +0100
committerDiego Biurrun <diego@biurrun.de>2016-09-03 15:11:29 +0200
commit4fb311c804098d78e5ce5f527f9a9c37536d3a08 (patch)
tree2bbbfe9c2147bee64ec742d6fcf13d16bf4e3adf /libavutil
parentf01f7a7846529b7c3ef343f117eaa2c0a1457af0 (diff)
Drop memalign hack
It no longer serves a useful purpose.
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/mem.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 15c28808c1..0f506d3604 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -62,22 +62,12 @@ void free(void *ptr);
void *av_malloc(size_t size)
{
void *ptr = NULL;
-#if CONFIG_MEMALIGN_HACK
- long diff;
-#endif
/* let's disallow possibly ambiguous cases */
if (size > (INT_MAX - 32) || !size)
return NULL;
-#if CONFIG_MEMALIGN_HACK
- ptr = malloc(size + 32);
- if (!ptr)
- return ptr;
- diff = ((-(long)ptr - 1) & 31) + 1;
- ptr = (char *)ptr + diff;
- ((char *)ptr)[-1] = diff;
-#elif HAVE_POSIX_MEMALIGN
+#if HAVE_POSIX_MEMALIGN
if (posix_memalign(&ptr, 32, size))
ptr = NULL;
#elif HAVE_ALIGNED_MALLOC
@@ -116,21 +106,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 > (INT_MAX - 16))
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];
- return (char *)realloc((char *)ptr - diff, size + diff) + diff;
-#elif HAVE_ALIGNED_MALLOC
+#if HAVE_ALIGNED_MALLOC
return _aligned_realloc(ptr, size, 32);
#else
return realloc(ptr, size);
@@ -189,10 +169,7 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
void av_free(void *ptr)
{
-#if CONFIG_MEMALIGN_HACK
- if (ptr)
- free((char *)ptr - ((char *)ptr)[-1]);
-#elif HAVE_ALIGNED_MALLOC
+#if HAVE_ALIGNED_MALLOC
_aligned_free(ptr);
#else
free(ptr);