From 5658c615d76e5062803c94ddd34ce3702ba8e782 Mon Sep 17 00:00:00 2001 From: maya Date: Fri, 27 Jul 2018 13:08:47 +0000 Subject: C17 conformance: aligned_alloc's size doesn't need to be a multiple of alignment any more. Thanks Joseph Myers for the heads up. --- lib/libc/stdlib/aligned_alloc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/libc/stdlib/aligned_alloc.c') 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; } -- cgit