Module Name: src
Committed By: maya
Date: Fri Jul 27 13:08:47 UTC 2018
Modified Files:
src/lib/libc/stdlib: aligned_alloc.c posix_memalign.3
Log Message:
C17 conformance: aligned_alloc's size doesn't need to be a multiple of
alignment any more.
Thanks Joseph Myers for the heads up.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/stdlib/aligned_alloc.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/stdlib/posix_memalign.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdlib/aligned_alloc.c
diff -u src/lib/libc/stdlib/aligned_alloc.c:1.1 src/lib/libc/stdlib/aligned_alloc.c:1.2
--- src/lib/libc/stdlib/aligned_alloc.c:1.1 Sat Nov 7 16:21:42 2015
+++ src/lib/libc/stdlib/aligned_alloc.c Fri Jul 27 13:08:47 2018
@@ -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 s
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;
}
Index: src/lib/libc/stdlib/posix_memalign.3
diff -u src/lib/libc/stdlib/posix_memalign.3:1.3 src/lib/libc/stdlib/posix_memalign.3:1.4
--- src/lib/libc/stdlib/posix_memalign.3:1.3 Sat Nov 7 18:47:26 2015
+++ src/lib/libc/stdlib/posix_memalign.3 Fri Jul 27 13:08:47 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: posix_memalign.3,v 1.3 2015/11/07 18:47:26 wiz Exp $
+.\" $NetBSD: posix_memalign.3,v 1.4 2018/07/27 13:08:47 maya Exp $
.\"
.\" Copyright (C) 2006 Jason Evans <[email protected]>.
.\" All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" FreeBSD: src/lib/libc/stdlib/posix_memalign.3,v 1.3 2007/03/28 04:32:51 jasone Exp
.\"
-.Dd October 30, 2015
+.Dd July 27, 2018
.Dt POSIX_MEMALIGN 3
.Os
.Sh NAME
@@ -65,10 +65,7 @@ bytes of memory such that the allocation
.Fa alignment .
The requested
.Fa alignment
-must be a power of 2 and
-.Fa size
-must be a integer multiple of
-.Fa alignment .
+must be a power of 2.
.Pp
Memory that is allocated via
.Fn posix_memalign