Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/stdlib Fix code style errors pointed out by c...



details:   https://anonhg.NetBSD.org/src/rev/3157545fad8b
branches:  trunk
changeset: 341468:3157545fad8b
user:      nros <nros%NetBSD.org@localhost>
date:      Sat Nov 07 17:35:31 2015 +0000

description:
Fix code style errors pointed out by christos during the review of the
aligned_alloc test that also applies to the posix_memalign test.
Fix code style errors that I forgot to fix in the aligned_alloc test.

diffstat:

 tests/lib/libc/stdlib/t_posix_memalign.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (58 lines):

diff -r 46cc2a0e7f06 -r 3157545fad8b tests/lib/libc/stdlib/t_posix_memalign.c
--- a/tests/lib/libc/stdlib/t_posix_memalign.c  Sat Nov 07 17:34:33 2015 +0000
+++ b/tests/lib/libc/stdlib/t_posix_memalign.c  Sat Nov 07 17:35:31 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_posix_memalign.c,v 1.3 2015/11/07 16:21:42 nros Exp $ */
+/*     $NetBSD: t_posix_memalign.c,v 1.4 2015/11/07 17:35:31 nros Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_posix_memalign.c,v 1.3 2015/11/07 16:21:42 nros Exp $");
+__RCSID("$NetBSD: t_posix_memalign.c,v 1.4 2015/11/07 17:35:31 nros Exp $");
 
 #include <atf-c.h>
 
@@ -50,10 +50,10 @@
 }
 ATF_TC_BODY(posix_memalign_basic, tc)
 {
-       size_t size[] = {
+       static const size_t size[] = {
                1, 2, 3, 4, 10, 100, 16384, 32768, 65536
        };
-       size_t align[] = {
+       static const size_t align[] = {
                512, 1024, 16, 32, 64, 4, 2048, 16, 2
        };
 
@@ -64,7 +64,7 @@
                int ret;
                p = (void*)0x1;
 
-               (void)printf("Checking posix_memalign(&p, %zd, %zd)...\n",
+               (void)printf("Checking posix_memalign(&p, %zu, %zu)...\n",
                        align[i], size[i]);
                ret = posix_memalign(&p, align[i], size[i]);
 
@@ -104,7 +104,7 @@
                    align[i], size[i]);
                p = aligned_alloc(align[i], size[i]);
                 if (p == NULL) {
-                       if (align[i] == 0 || ((align[i]-1) & align[i]) != 0 ||
+                       if (align[i] == 0 || ((align[i] - 1) & align[i]) != 0 ||
                            size[i] % align[i] != 0) {
                                ATF_REQUIRE_EQ_MSG(errno, EINVAL,
                                    "aligned_alloc: %s", strerror(errno));
@@ -118,7 +118,7 @@
                        ATF_REQUIRE_EQ_MSG(align[i] == 0, false,
                            "aligned_alloc: success when alignment was not "
                            "a power of 2");
-                       ATF_REQUIRE_EQ_MSG((align[i]-1) & align[i], 0,
+                       ATF_REQUIRE_EQ_MSG((align[i] - 1) & align[i], 0,
                            "aligned_alloc: success when alignment was not "
                            "a power of 2");
                        ATF_REQUIRE_EQ_MSG(size[i] % align[i], 0,



Home | Main Index | Thread Index | Old Index