Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/stdlib C17 conformance: aligned_alloc's size doesn'...



details:   https://anonhg.NetBSD.org/src/rev/3161b7f58d6c
branches:  trunk
changeset: 991713:3161b7f58d6c
user:      maya <maya%NetBSD.org@localhost>
date:      Fri Jul 27 13:08:47 2018 +0000

description:
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:

 lib/libc/stdlib/aligned_alloc.c  |  8 +++-----
 lib/libc/stdlib/posix_memalign.3 |  9 +++------
 2 files changed, 6 insertions(+), 11 deletions(-)

diffs (53 lines):

diff -r bae7e3b78db3 -r 3161b7f58d6c lib/libc/stdlib/aligned_alloc.c
--- a/lib/libc/stdlib/aligned_alloc.c   Fri Jul 27 12:02:25 2018 +0000
+++ b/lib/libc/stdlib/aligned_alloc.c   Fri Jul 27 13:08:47 2018 +0000
@@ -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 @@
         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;
         }
diff -r bae7e3b78db3 -r 3161b7f58d6c lib/libc/stdlib/posix_memalign.3
--- a/lib/libc/stdlib/posix_memalign.3  Fri Jul 27 12:02:25 2018 +0000
+++ b/lib/libc/stdlib/posix_memalign.3  Fri Jul 27 13:08:47 2018 +0000
@@ -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 <jasone%FreeBSD.org@localhost>.
 .\" 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 @@
 .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



Home | Main Index | Thread Index | Old Index