summaryrefslogtreecommitdiff
path: root/src/malloc/posix_memalign.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2020-06-03 19:11:23 -0400
committerRich Felker <dalias@aerifal.cx>2020-06-03 19:11:23 -0400
commitd1e6fdd3674eff0e09554c7ddc431acb8925232f (patch)
tree0181f78dc2700d2028eb2e354030c648326506a6 /src/malloc/posix_memalign.c
parentde798308e8a06608bb5a184dc209002ae1e0a142 (diff)
downloadmusl-d1e6fdd3674eff0e09554c7ddc431acb8925232f.tar.gz
reverse dependency order of memalign and aligned_alloc
this change eliminates the internal __memalign function and makes the memalign and posix_memalign functions completely independent of the malloc implementation, written portably in terms of aligned_alloc.
Diffstat (limited to 'src/malloc/posix_memalign.c')
-rw-r--r--src/malloc/posix_memalign.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/malloc/posix_memalign.c b/src/malloc/posix_memalign.c
index 2ea8bd8a..ad4d8f47 100644
--- a/src/malloc/posix_memalign.c
+++ b/src/malloc/posix_memalign.c
@@ -1,11 +1,10 @@
#include <stdlib.h>
#include <errno.h>
-#include "malloc_impl.h"
int posix_memalign(void **res, size_t align, size_t len)
{
if (align < sizeof(void *)) return EINVAL;
- void *mem = __memalign(align, len);
+ void *mem = aligned_alloc(align, len);
if (!mem) return errno;
*res = mem;
return 0;