Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): replace *a->b with a->b[0]



details:   https://anonhg.NetBSD.org/src/rev/e505823b51b7
branches:  trunk
changeset: 954788:e505823b51b7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Sep 11 04:32:39 2020 +0000

description:
make(1): replace *a->b with a->b[0]

This allows the code to be read strictly from left to right.  In most
places this style was already used.

diffstat:

 usr.bin/make/dir.c     |   8 ++++----
 usr.bin/make/job.c     |  16 ++++++++--------
 usr.bin/make/strlist.c |   8 ++++----
 usr.bin/make/suff.c    |   8 ++++----
 usr.bin/make/var.c     |   8 ++++----
 5 files changed, 24 insertions(+), 24 deletions(-)

diffs (201 lines):

diff -r d4856a18c46a -r e505823b51b7 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Fri Sep 11 04:22:22 2020 +0000
+++ b/usr.bin/make/dir.c        Fri Sep 11 04:32:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.137 2020/09/07 19:48:08 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.137 2020/09/07 19:48:08 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c      8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.137 2020/09/07 19:48:08 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.138 2020/09/11 04:32:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -579,7 +579,7 @@
     Hash_Entry *entry;         /* Current entry in the table */
     Boolean isDot;             /* TRUE if the directory being searched is . */
 
-    isDot = (*p->name == '.' && p->name[1] == '\0');
+    isDot = (p->name[0] == '.' && p->name[1] == '\0');
 
     for (entry = Hash_EnumFirst(&p->files, &search);
         entry != NULL;
diff -r d4856a18c46a -r e505823b51b7 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Fri Sep 11 04:22:22 2020 +0000
+++ b/usr.bin/make/job.c        Fri Sep 11 04:32:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.228 2020/09/07 05:32:12 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.229 2020/09/11 04:32:39 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.228 2020/09/07 05:32:12 rillig Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.229 2020/09/11 04:32:39 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c      8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.228 2020/09/07 05:32:12 rillig Exp $");
+__RCSID("$NetBSD: job.c,v 1.229 2020/09/11 04:32:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -804,7 +804,7 @@
                        DBPRINTF("%s\n", commandShell->ignErr);
                }
            } else if (commandShell->ignErr &&
-                     (*commandShell->ignErr != '\0'))
+                      commandShell->ignErr[0] != '\0')
            {
                /*
                 * The shell has no error control, so we need to be
@@ -849,7 +849,7 @@
         */
 
        if (!commandShell->hasErrCtl && commandShell->errOut &&
-           (*commandShell->errOut != '\0')) {
+           commandShell->errOut[0] != '\0') {
                if (!(job->flags & JOB_SILENT) && !shutUp) {
                        if (commandShell->hasEchoCtl) {
                                DBPRINTF("%s\n", commandShell->echoOff);
@@ -1474,8 +1474,8 @@
     argv[0] = UNCONST(shellName);
     argc = 1;
 
-    if ((commandShell->exit && (*commandShell->exit != '-')) ||
-       (commandShell->echo && (*commandShell->echo != '-')))
+    if ((commandShell->exit && commandShell->exit[0] != '-') ||
+       (commandShell->echo && commandShell->echo[0] != '-'))
     {
        /*
         * At least one of the flags doesn't have a minus before it, so
@@ -2179,7 +2179,7 @@
     if (commandShell->echo == NULL) {
        commandShell->echo = "";
     }
-    if (commandShell->hasErrCtl && *commandShell->exit) {
+    if (commandShell->hasErrCtl && commandShell->exit[0] != '\0') {
        if (shellErrFlag &&
            strcmp(commandShell->exit, &shellErrFlag[1]) != 0) {
            free(shellErrFlag);
diff -r d4856a18c46a -r e505823b51b7 usr.bin/make/strlist.c
--- a/usr.bin/make/strlist.c    Fri Sep 11 04:22:22 2020 +0000
+++ b/usr.bin/make/strlist.c    Fri Sep 11 04:32:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strlist.c,v 1.6 2020/08/25 17:37:09 rillig Exp $       */
+/*     $NetBSD: strlist.c,v 1.7 2020/09/11 04:32:39 rillig Exp $       */
 
 /*-
  * Copyright (c) 2008 - 2009 The NetBSD Foundation, Inc.
@@ -33,11 +33,11 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: strlist.c,v 1.6 2020/08/25 17:37:09 rillig Exp $";
+static char rcsid[] = "$NetBSD: strlist.c,v 1.7 2020/09/11 04:32:39 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: strlist.c,v 1.6 2020/08/25 17:37:09 rillig Exp $");
+__RCSID("$NetBSD: strlist.c,v 1.7 2020/09/11 04:32:39 rillig Exp $");
 #endif /* not lint */
 #endif
 
@@ -80,7 +80,7 @@
        sl->sl_num = n;
        items = sl->sl_items;
        if (n >= sl->sl_max) {
-               items = bmake_realloc(items, (n + 7) * sizeof *sl->sl_items);
+               items = bmake_realloc(items, (n + 7) * sizeof *items);
                sl->sl_items = items;
                sl->sl_max = n + 6;
        }
diff -r d4856a18c46a -r e505823b51b7 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Fri Sep 11 04:22:22 2020 +0000
+++ b/usr.bin/make/suff.c       Fri Sep 11 04:32:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.145 2020/09/08 05:26:21 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.146 2020/09/11 04:32:39 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.145 2020/09/08 05:26:21 rillig Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.146 2020/09/11 04:32:39 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c     8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.145 2020/09/08 05:26:21 rillig Exp $");
+__RCSID("$NetBSD: suff.c,v 1.146 2020/09/11 04:32:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -969,7 +969,7 @@
 
     targ = ls->s;
 
-    if ((s->flags & SUFF_NULL) && (*s->name != '\0')) {
+    if ((s->flags & SUFF_NULL) && s->name[0] != '\0') {
        /*
         * If the suffix has been marked as the NULL suffix, also create a Src
         * structure for a file with no suffix attached. Two birds, and all
diff -r d4856a18c46a -r e505823b51b7 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Fri Sep 11 04:22:22 2020 +0000
+++ b/usr.bin/make/var.c        Fri Sep 11 04:32:39 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.491 2020/09/08 05:26:21 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.492 2020/09/11 04:32:39 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.491 2020/09/08 05:26:21 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.492 2020/09/11 04:32:39 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.491 2020/09/08 05:26:21 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.492 2020/09/11 04:32:39 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2969,7 +2969,7 @@
      * string. Note the pattern is anchored at the end.
      */
     (*pp)--;
-    if (lhs[0] == '\0' && *st->val == '\0') {
+    if (lhs[0] == '\0' && st->val[0] == '\0') {
        st->newVal = st->val;   /* special case */
     } else {
        ModifyWord_SYSVSubstArgs args = {st->ctxt, lhs, rhs};



Home | Main Index | Thread Index | Old Index