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): use comparisons in boolean expressions



details:   https://anonhg.NetBSD.org/src/rev/1a5d94aff246
branches:  trunk
changeset: 957310:1a5d94aff246
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Nov 23 23:41:11 2020 +0000

description:
make(1): use comparisons in boolean expressions

The generated code stays exactly the same.

diffstat:

 usr.bin/make/compat.c                 |   6 +++---
 usr.bin/make/dir.c                    |  18 +++++++++---------
 usr.bin/make/filemon/filemon_dev.c    |   4 ++--
 usr.bin/make/filemon/filemon_ktrace.c |   6 +++---
 usr.bin/make/job.c                    |  22 +++++++++++-----------
 usr.bin/make/main.c                   |   6 +++---
 usr.bin/make/meta.c                   |  26 +++++++++++++-------------
 usr.bin/make/parse.c                  |   8 ++++----
 usr.bin/make/targ.c                   |   6 +++---
 usr.bin/make/util.c                   |   6 +++---
 usr.bin/make/var.c                    |  12 ++++++------
 11 files changed, 60 insertions(+), 60 deletions(-)

diffs (truncated from 517 to 300 lines):

diff -r 4523d1370e08 -r 1a5d94aff246 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Mon Nov 23 23:00:36 2020 +0000
+++ b/usr.bin/make/compat.c     Mon Nov 23 23:41:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.186 2020/11/23 19:35:10 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.187 2020/11/23 23:41:11 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.186 2020/11/23 19:35:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.187 2020/11/23 23:41:11 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -436,7 +436,7 @@
 
        free(cmdStart);
        compatChild = 0;
-       if (compatSigno) {
+       if (compatSigno != 0) {
                bmake_signal(compatSigno, SIG_DFL);
                kill(myPid, compatSigno);
        }
diff -r 4523d1370e08 -r 1a5d94aff246 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Mon Nov 23 23:00:36 2020 +0000
+++ b/usr.bin/make/dir.c        Mon Nov 23 23:41:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.221 2020/11/23 23:00:36 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.222 2020/11/23 23:41:11 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -134,7 +134,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.221 2020/11/23 23:00:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.222 2020/11/23 23:41:11 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -447,7 +447,7 @@
 Dir_End(void)
 {
 #ifdef CLEANUP
-       if (cur) {
+       if (cur != NULL) {
                cur->refCount--;
                Dir_Destroy(cur);
        }
@@ -484,9 +484,9 @@
        }
 
        if (!hasLastDot) {
-               if (dot)
+               if (dot != NULL)
                        Var_Append(".PATH", dot->name, VAR_GLOBAL);
-               if (cur)
+               if (cur != NULL)
                        Var_Append(".PATH", cur->name, VAR_GLOBAL);
        }
 
@@ -500,9 +500,9 @@
        }
 
        if (hasLastDot) {
-               if (dot)
+               if (dot != NULL)
                        Var_Append(".PATH", dot->name, VAR_GLOBAL);
-               if (cur)
+               if (cur != NULL)
                        Var_Append(".PATH", cur->name, VAR_GLOBAL);
        }
 }
@@ -992,7 +992,7 @@
         * slash in it (the name, I mean)
         */
        base = strrchr(name, '/');
-       if (base) {
+       if (base != NULL) {
                hasSlash = TRUE;
                base++;
        } else {
@@ -1086,7 +1086,7 @@
                DIR_DEBUG0("   Trying subdirectories...\n");
 
                if (!hasLastDot) {
-                       if (dot) {
+                       if (dot != NULL) {
                                checkedDot = TRUE;
                                if ((file = DirLookupSubdir(dot, name)) != NULL)
                                        return file;
diff -r 4523d1370e08 -r 1a5d94aff246 usr.bin/make/filemon/filemon_dev.c
--- a/usr.bin/make/filemon/filemon_dev.c        Mon Nov 23 23:00:36 2020 +0000
+++ b/usr.bin/make/filemon/filemon_dev.c        Mon Nov 23 23:41:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filemon_dev.c,v 1.4 2020/11/05 17:27:16 rillig Exp $   */
+/*     $NetBSD: filemon_dev.c,v 1.5 2020/11/23 23:41:11 rillig Exp $   */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -127,7 +127,7 @@
        free(F);
 
        /* Set errno and return -1 if anything went wrong.  */
-       if (error) {
+       if (error != 0) {
                errno = error;
                return -1;
        }
diff -r 4523d1370e08 -r 1a5d94aff246 usr.bin/make/filemon/filemon_ktrace.c
--- a/usr.bin/make/filemon/filemon_ktrace.c     Mon Nov 23 23:00:36 2020 +0000
+++ b/usr.bin/make/filemon/filemon_ktrace.c     Mon Nov 23 23:41:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filemon_ktrace.c,v 1.5 2020/11/23 20:41:20 rillig Exp $        */
+/*     $NetBSD: filemon_ktrace.c,v 1.6 2020/11/23 23:41:11 rillig Exp $        */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -262,7 +262,7 @@
        F->out = NULL;
 
        /* Set errno and return -1 if anything went wrong.  */
-       if (error) {
+       if (error != 0) {
                errno = error;
                return -1;
        }
@@ -373,7 +373,7 @@
        free(F);
 
        /* Set errno and return -1 if anything went wrong.  */
-       if (error) {
+       if (error != 0) {
                errno = error;
                return -1;
        }
diff -r 4523d1370e08 -r 1a5d94aff246 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Mon Nov 23 23:00:36 2020 +0000
+++ b/usr.bin/make/job.c        Mon Nov 23 23:41:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.327 2020/11/23 20:41:20 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.328 2020/11/23 23:41:11 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.327 2020/11/23 20:41:20 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.328 2020/11/23 23:41:11 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -1838,7 +1838,7 @@
     (void)Make_Run(lst);
     Lst_Destroy(lst, NULL);
     JobStart(targ, JOB_SPECIAL);
-    while (jobTokensRunning) {
+    while (jobTokensRunning != 0) {
        Job_CatchOutput();
     }
 #else
@@ -2033,15 +2033,15 @@
            free(shellErrFlag);
            shellErrFlag = NULL;
        }
-       if (!shellErrFlag) {
+       if (shellErrFlag == NULL) {
            size_t n = strlen(commandShell->exit) + 2;
 
            shellErrFlag = bmake_malloc(n);
-           if (shellErrFlag) {
+           if (shellErrFlag != NULL) {
                snprintf(shellErrFlag, n, "-%s", commandShell->exit);
            }
        }
-    } else if (shellErrFlag) {
+    } else if (shellErrFlag != NULL) {
        free(shellErrFlag);
        shellErrFlag = NULL;
     }
@@ -2058,7 +2058,7 @@
 void
 Job_SetPrefix(void)
 {
-    if (targPrefix) {
+    if (targPrefix != NULL) {
        free(targPrefix);
     } else if (!Var_Exists(MAKE_JOB_PREFIX, VAR_GLOBAL)) {
        Var_Set(MAKE_JOB_PREFIX, "---", VAR_GLOBAL);
@@ -2330,7 +2330,7 @@
            }
            commandShell = sh;
            shellName = newShell.name;
-           if (shellPath) {
+           if (shellPath != NULL) {
                /* Shell_Init has already been called!  Do it again. */
                free(UNCONST(shellPath));
                shellPath = NULL;
@@ -2451,7 +2451,7 @@
 {
     GNode *endNode = Targ_GetEndNode();
     if (!Lst_IsEmpty(endNode->commands) || !Lst_IsEmpty(endNode->children)) {
-       if (errors) {
+       if (errors != 0) {
            Error("Errors reported so .END ignored");
        } else {
            JobRun(endNode);
@@ -2494,7 +2494,7 @@
 
     aborting = ABORT_ERROR;
 
-    if (jobTokensRunning) {
+    if (jobTokensRunning != 0) {
        for (job = job_table; job < job_table_end; job++) {
            if (job->status != JOB_ST_RUNNING)
                continue;
@@ -2735,7 +2735,7 @@
     if (gn == NULL)
        return FALSE;
 
-    if (fname)
+    if (fname != NULL)
        Var_Set(ALLSRC, fname, gn);
 
     JobRun(gn);
diff -r 4523d1370e08 -r 1a5d94aff246 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Mon Nov 23 23:00:36 2020 +0000
+++ b/usr.bin/make/main.c       Mon Nov 23 23:41:11 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.477 2020/11/23 20:52:59 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.478 2020/11/23 23:41:11 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.477 2020/11/23 20:52:59 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.478 2020/11/23 23:41:11 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -2214,7 +2214,7 @@
        if ((fd = mkstemp(tfile)) < 0)
                Punt("Could not create temporary file %s: %s", tfile,
                    strerror(errno));
-       if (out_fname) {
+       if (out_fname != NULL) {
                *out_fname = bmake_strdup(tfile);
        } else {
                unlink(
diff -r 4523d1370e08 -r 1a5d94aff246 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Mon Nov 23 23:00:36 2020 +0000
+++ b/usr.bin/make/meta.c       Mon Nov 23 23:41:11 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.146 2020/11/23 20:52:59 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.147 2020/11/23 23:41:11 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -218,7 +218,7 @@
 
     do {
        cp = strstr(buf, eat);
-       if (cp) {
+       if (cp != NULL) {
            cp2 = cp + eatlen;
            if (dots == 2 && cp > buf) {
                do {
@@ -231,7 +231,7 @@
                return;                 /* can't happen? */
            }
        }
-    } while (cp);
+    } while (cp != NULL);
 }
 
 static char *
@@ -408,7 +408,7 @@
  */
 static Boolean
 meta_needed(GNode *gn, const char *dname, const char *tname,
-            char *objdir, int verbose)
+            char *objdir, Boolean verbose)
 {
     struct cached_stat cst;
 
@@ -588,7 +588,7 @@
 void
 meta_mode_init(const char *make_mode)
 {
-    static int once = 0;



Home | Main Index | Thread Index | Old Index