Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libcurses/slave tests/libcurses: add parentheses a...



details:   https://anonhg.NetBSD.org/src/rev/943fd4e1acda
branches:  trunk
changeset: 983905:943fd4e1acda
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jun 13 12:46:01 2021 +0000

description:
tests/libcurses: add parentheses around argument to sizeof

diffstat:

 tests/lib/libcurses/slave/commands.c |  12 ++++++------
 tests/lib/libcurses/slave/slave.c    |  12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diffs (86 lines):

diff -r f77a0413c354 -r 943fd4e1acda tests/lib/libcurses/slave/commands.c
--- a/tests/lib/libcurses/slave/commands.c      Sun Jun 13 11:06:20 2021 +0000
+++ b/tests/lib/libcurses/slave/commands.c      Sun Jun 13 12:46:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: commands.c,v 1.14 2021/02/15 07:06:27 rillig Exp $     */
+/*     $NetBSD: commands.c,v 1.15 2021/06/13 12:46:01 rillig Exp $     */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -98,7 +98,7 @@
 static void
 write_to_director_int(int i)
 {
-       write_to_director(&i, sizeof i);
+       write_to_director(&i, sizeof(i));
 }
 
 static void
@@ -218,7 +218,7 @@
        for (p = string; (*p & __CHARTEXT) != 0; p++)
                continue;
 
-       size = (size_t)(p + 1 - string) * sizeof *p;
+       size = (size_t)(p + 1 - string) * sizeof(*p);
 
        write_to_director_type(data_byte);
        write_to_director_int(size);
@@ -233,8 +233,8 @@
 {
 
        write_to_director_type(data_cchar);
-       write_to_director_int(sizeof c);
-       write_to_director(&c, sizeof c);
+       write_to_director_int(sizeof(c));
+       write_to_director(&c, sizeof(c));
 }
 
 /*
@@ -262,7 +262,7 @@
 
        for (p = wstr; *p != L'\0'; p++)
                continue;
-       size = (size_t)(p + 1 - wstr) * sizeof *p;
+       size = (size_t)(p + 1 - wstr) * sizeof(*p);
 
 
        write_to_director_type(data_wchar);
diff -r f77a0413c354 -r 943fd4e1acda tests/lib/libcurses/slave/slave.c
--- a/tests/lib/libcurses/slave/slave.c Sun Jun 13 11:06:20 2021 +0000
+++ b/tests/lib/libcurses/slave/slave.c Sun Jun 13 12:46:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: slave.c,v 1.16 2021/02/13 10:03:49 rillig Exp $        */
+/*     $NetBSD: slave.c,v 1.17 2021/06/13 12:46:01 rillig Exp $        */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -82,12 +82,12 @@
        int type, len;
        char **args = *pargs;
 
-       read_from_director(&type, sizeof type);
-       read_from_director(&len, sizeof len);
+       read_from_director(&type, sizeof(type));
+       read_from_director(&len, sizeof(len));
        if (len < 0)
                return false;
 
-       args = realloc(args, (argslen + 1) * sizeof args[0]);
+       args = realloc(args, (argslen + 1) * sizeof(args[0]));
        if (args == NULL)
                err(1, "slave realloc of args array failed");
        *pargs = args;
@@ -134,11 +134,11 @@
        if ((cmdbuf = malloc(maxlen)) == NULL)
                err(1, "slave cmdbuf malloc failed");
 
-       while (try_read_from_director(&type, sizeof type)) {
+       while (try_read_from_director(&type, sizeof(type))) {
                if (type != data_string)
                        errx(1, "Unexpected type for command, got %d", type);
 
-               read_from_director(&len, sizeof len);
+               read_from_director(&len, sizeof(len));
 
                if ((len + 1) > maxlen) {
                        maxlen = len + 1;



Home | Main Index | Thread Index | Old Index