summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/aligned_alloc.c
diff options
context:
space:
mode:
authormaya <maya@NetBSD.org>2018-07-27 13:08:47 +0000
committermaya <maya@NetBSD.org>2018-07-27 13:08:47 +0000
commit5658c615d76e5062803c94ddd34ce3702ba8e782 (patch)
treecfe67518c2ec8f1db416122e82939eaae08fc121 /lib/libc/stdlib/aligned_alloc.c
parent2805cc0deacf769a41c6fd6afb0cdb27166fe822 (diff)
C17 conformance: aligned_alloc's size doesn't need to be a multiple of
alignment any more. Thanks Joseph Myers for the heads up.
Diffstat (limited to 'lib/libc/stdlib/aligned_alloc.c')
-rw-r--r--lib/libc/stdlib/aligned_alloc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/stdlib/aligned_alloc.c b/lib/libc/stdlib/aligned_alloc.c
index ab116333a43..8d4aad043b6 100644
--- a/lib/libc/stdlib/aligned_alloc.c
+++ b/lib/libc/stdlib/aligned_alloc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aligned_alloc.c,v 1.1 2015/11/07 16:21:42 nros Exp $ */
+/* $NetBSD: aligned_alloc.c,v 1.2 2018/07/27 13:08:47 maya Exp $ */
/*-
* Copyright (C) 2015 The NetBSD Foundation, Inc.
@@ -42,11 +42,9 @@ aligned_alloc(size_t alignment, size_t size)
int err;
/*
- * Check that alignment is a power of 2
- * and that size is an integer multiple of alignment.
+ * Check that alignment is a power of 2.
*/
- if (alignment == 0 || ((alignment - 1) & alignment) != 0 ||
- (size & (alignment-1)) != 0) {
+ if (alignment == 0 || ((alignment - 1) & alignment) != 0) {
errno = EINVAL;
return NULL;
}