Browse Source

compat: fix default aligned_alloc()

pull/94/head
Rémi Denis-Courmont 7 years ago
parent
commit
577ba74815
  1. 9
      compat/aligned_alloc.c

9
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
}

Loading…
Cancel
Save