summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/stdlib.h6
-rw-r--r--libc/stdlib/malloc-standard/memalign.c1
-rw-r--r--libc/stdlib/malloc/memalign.c1
3 files changed, 8 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index ba8849ed0..a108c84a9 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -529,6 +529,12 @@ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
__THROW __nonnull ((1)) __wur;
#endif
+#ifdef __USE_ISOC11
+/* ISO C variant of aligned allocation. */
+extern void *aligned_alloc (size_t __alignment, size_t __size)
+ __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur;
+#endif
+
__BEGIN_NAMESPACE_STD
/* Abort execution and generate a core-dump. */
extern void abort (void) __THROW __attribute__ ((__noreturn__));
diff --git a/libc/stdlib/malloc-standard/memalign.c b/libc/stdlib/malloc-standard/memalign.c
index e9ae5a7b9..8cd6f582c 100644
--- a/libc/stdlib/malloc-standard/memalign.c
+++ b/libc/stdlib/malloc-standard/memalign.c
@@ -127,4 +127,5 @@ void* memalign(size_t alignment, size_t bytes)
__MALLOC_UNLOCK;
return retval;
}
+weak_alias(memalign, aligned_alloc)
libc_hidden_def(memalign)
diff --git a/libc/stdlib/malloc/memalign.c b/libc/stdlib/malloc/memalign.c
index 74d5dbd2d..6943279ac 100644
--- a/libc/stdlib/malloc/memalign.c
+++ b/libc/stdlib/malloc/memalign.c
@@ -93,4 +93,5 @@ memalign (size_t alignment, size_t size)
return MALLOC_SETUP (base, end_addr - (unsigned long)base);
}
+weak_alias(memalign, aligned_alloc)
libc_hidden_def(memalign)