From 651416182dc65d75e91cadfec65dd72f9ff07846 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 4 Jul 2013 23:54:12 -0400 Subject: move alignment check from aligned_alloc to posix_memalign C11 has no requirement that the alignment be a multiple of sizeof(void*), and in fact seems to require any "valid alignment supported by the implementation" to work. since the alignment of char is 1 and thus a valid alignment, an alignment argument of 1 should be accepted. --- src/malloc/aligned_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/malloc/aligned_alloc.c') diff --git a/src/malloc/aligned_alloc.c b/src/malloc/aligned_alloc.c index 158dba41..c6386629 100644 --- a/src/malloc/aligned_alloc.c +++ b/src/malloc/aligned_alloc.c @@ -11,7 +11,7 @@ void *aligned_alloc(size_t align, size_t len) unsigned char *mem, *new, *end; size_t header, footer; - if ((align & -align & -sizeof(void *)) != align) { + if ((align & -align) != align) { errno = EINVAL; return NULL; } -- cgit v1.2.1