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/0841c4030c8e
branches:  trunk
changeset: 379662:0841c4030c8e
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 3caed2405d6a -r 0841c4030c8e 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 @@ write_to_director(const void *mem, size_
 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 @@ report_nstr(chtype *string)
        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 @@ report_cchar(cchar_t c)
 {
 
        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 @@ report_wstr(wchar_t *wstr)
 
        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 3caed2405d6a -r 0841c4030c8e 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 @@ read_command_argument(char ***pargs, int
        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 @@ process_commands(void)
        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