vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Fri Jul 26 21:29:16 2019 +0300| [577ba74815832c0565cbd9e65cb73edee719b398] | committer: Rémi Denis-Courmont
compat: fix default aligned_alloc() > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=577ba74815832c0565cbd9e65cb73edee719b398 --- compat/aligned_alloc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compat/aligned_alloc.c b/compat/aligned_alloc.c index 02881eeeb0..d03299d25f 100644 --- a/compat/aligned_alloc.c +++ b/compat/aligned_alloc.c @@ -23,6 +23,8 @@ #endif #include <assert.h> +#include <stdalign.h> +#include <stddef.h> #include <stdlib.h> #include <errno.h> #if !defined (HAVE_POSIX_MEMALIGN) @@ -59,9 +61,8 @@ void *aligned_alloc(size_t align, size_t size) #elif defined (_WIN32) && defined(_MSC_VER) return _aligned_malloc(size, align); #else -#warning unsupported aligned allocation! - if (size > 0) - errno = ENOMEM; - return NULL; + /* align must be valid/supported */ + assert(align <= alignof (max_align_t)); + return malloc(((void) align, size)); #endif } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
