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 pointers in controlling condit...



details:   https://anonhg.NetBSD.org/src/rev/70afa6e5da58
branches:  trunk
changeset: 1017569:70afa6e5da58
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Dec 31 17:39:36 2020 +0000

description:
make(1): replace pointers in controlling conditions with booleans

diffstat:

 usr.bin/make/filemon/filemon_ktrace.c |   4 +-
 usr.bin/make/main.c                   |  10 ++++----
 usr.bin/make/meta.c                   |  40 +++++++++++++++++-----------------
 usr.bin/make/parse.c                  |   6 ++--
 4 files changed, 30 insertions(+), 30 deletions(-)

diffs (223 lines):

diff -r 3ef9678885b4 -r 70afa6e5da58 usr.bin/make/filemon/filemon_ktrace.c
--- a/usr.bin/make/filemon/filemon_ktrace.c     Thu Dec 31 16:19:05 2020 +0000
+++ b/usr.bin/make/filemon/filemon_ktrace.c     Thu Dec 31 17:39:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filemon_ktrace.c,v 1.8 2020/11/29 09:27:40 rillig Exp $        */
+/*     $NetBSD: filemon_ktrace.c,v 1.9 2020/12/31 17:39:36 rillig Exp $        */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -772,7 +772,7 @@
        const register_t *args = (const void *)&call[1];
        int status = (int)args[0];
 
-       if (F->out) {
+       if (F->out != NULL) {
                fprintf(F->out, "X %jd %d\n", (intmax_t)key->pid, status);
                if (key->pid == F->child) {
                        fprintf(F->out, "# Bye bye\n");
diff -r 3ef9678885b4 -r 70afa6e5da58 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Thu Dec 31 16:19:05 2020 +0000
+++ b/usr.bin/make/main.c       Thu Dec 31 17:39:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.507 2020/12/30 10:03:16 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.508 2020/12/31 17:39:36 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -110,7 +110,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.507 2020/12/30 10:03:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.508 2020/12/31 17:39:36 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -828,12 +828,12 @@
        }
 
        if (mode.str[0] != '\0') {
-               if (strstr(mode.str, "compat")) {
+               if (strstr(mode.str, "compat") != NULL) {
                        opts.compatMake = TRUE;
                        forceJobs = FALSE;
                }
 #if USE_META
-               if (strstr(mode.str, "meta"))
+               if (strstr(mode.str, "meta") != NULL)
                        meta_mode_init(mode.str);
 #endif
        }
@@ -844,7 +844,7 @@
 static void
 PrintVar(const char *varname, Boolean expandVars)
 {
-       if (strchr(varname, '$')) {
+       if (strchr(varname, '$') != NULL) {
                char *evalue;
                (void)Var_Subst(varname, VAR_GLOBAL, VARE_WANTRES, &evalue);
                /* TODO: handle errors */
diff -r 3ef9678885b4 -r 70afa6e5da58 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Thu Dec 31 16:19:05 2020 +0000
+++ b/usr.bin/make/meta.c       Thu Dec 31 17:39:36 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.165 2020/12/22 22:31:50 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.166 2020/12/31 17:39:36 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -254,9 +254,9 @@
      * So we use realpath() just to get the dirname, and leave the
      * basename as given to us.
      */
-    if ((cp = strrchr(tname, '/'))) {
-       if (cached_realpath(tname, buf)) {
-           if ((rp = strrchr(buf, '/'))) {
+    if ((cp = strrchr(tname, '/')) != NULL) {
+       if (cached_realpath(tname, buf) != NULL) {
+           if ((rp = strrchr(buf, '/')) != NULL) {
                rp++;
                cp++;
                if (strcmp(cp, rp) != 0)
@@ -327,7 +327,7 @@
        p_len = strlen(p_make);
     }
     cp = strchr(cmd, '$');
-    if ((cp)) {
+    if (cp != NULL) {
        (void)Var_Subst(cmd, gn, VARE_WANTRES, &mp);
        /* TODO: handle errors */
        cmd = mp;
@@ -374,7 +374,7 @@
 {
     char *cmd_freeIt = NULL;
 
-    if (strchr(cmd, '$')) {
+    if (strchr(cmd, '$') != NULL) {
        (void)Var_Subst(cmd, gn, VARE_WANTRES, &cmd_freeIt);
        /* TODO: handle errors */
        cmd = cmd_freeIt;
@@ -451,7 +451,7 @@
     }
 
     /* make sure these are canonical */
-    if (cached_realpath(dname, objdir_realpath))
+    if (cached_realpath(dname, objdir_realpath) != NULL)
        dname = objdir_realpath;
 
     /* If we aren't in the object directory, don't create a meta file. */
@@ -575,7 +575,7 @@
 
 
 #define get_mode_bf(bf, token) \
-    if ((cp = strstr(make_mode, token))) \
+    if ((cp = strstr(make_mode, token)) != NULL) \
        bf = boolValue(cp + sizeof (token) - 1)
 
 /*
@@ -593,15 +593,15 @@
     writeMeta = TRUE;
 
     if (make_mode != NULL) {
-       if (strstr(make_mode, "env"))
+       if (strstr(make_mode, "env") != NULL)
            metaEnv = TRUE;
-       if (strstr(make_mode, "verb"))
+       if (strstr(make_mode, "verb") != NULL)
            metaVerbose = TRUE;
-       if (strstr(make_mode, "read"))
+       if (strstr(make_mode, "read") != NULL)
            writeMeta = FALSE;
-       if (strstr(make_mode, "nofilemon"))
+       if (strstr(make_mode, "nofilemon") != NULL)
            useFilemon = FALSE;
-       if (strstr(make_mode, "ignore-cmd"))
+       if (strstr(make_mode, "ignore-cmd") != NULL)
            metaIgnoreCMDs = TRUE;
        if (useFilemon)
            get_mode_bf(filemonMissing, "missing-filemon=");
@@ -814,7 +814,7 @@
                (void)Var_Subst("${" MAKE_META_PREFIX "}",
                                VAR_GLOBAL, VARE_WANTRES, &meta_prefix);
                /* TODO: handle errors */
-               if ((cp2 = strchr(meta_prefix, '$')))
+               if ((cp2 = strchr(meta_prefix, '$')) != NULL)
                    meta_prefix_len = (size_t)(cp2 - meta_prefix);
                else
                    meta_prefix_len = strlen(meta_prefix);
@@ -843,7 +843,7 @@
        pbm = &Mybm;
 
 #ifdef USE_FILEMON
-    if (pbm->filemon) {
+    if (pbm->filemon != NULL) {
        while (filemon_process(pbm->filemon) > 0)
            continue;
        if (filemon_close(pbm->filemon) == -1)
@@ -1046,7 +1046,7 @@
 #define DEQUOTE(p) if (*p == '\'') {   \
     char *ep; \
     p++; \
-    if ((ep = strchr(p, '\''))) \
+    if ((ep = strchr(p, '\'')) != NULL) \
        *ep = '\0'; \
     }
 
@@ -1377,7 +1377,7 @@
 
                    /* ignore anything containing the string "tmp" */
                    /* XXX: The arguments to strstr must be swapped. */
-                   if ((strstr("tmp", p)))
+                   if (strstr("tmp", p) != NULL)
                        break;
 
                    if ((link_src != NULL && cached_lstat(p, &cst) < 0) ||
@@ -1493,9 +1493,9 @@
                    char *cmd = cmdNode->datum;
                    Boolean hasOODATE = FALSE;
 
-                   if (strstr(cmd, "$?"))
+                   if (strstr(cmd, "$?") != NULL)
                        hasOODATE = TRUE;
-                   else if ((cp = strstr(cmd, ".OODATE"))) {
+                   else if ((cp = strstr(cmd, ".OODATE")) != NULL) {
                        /* check for $[{(].OODATE[:)}] */
                        if (cp > cmd + 2 && cp[-2] == '$')
                            hasOODATE = TRUE;
@@ -1508,7 +1508,7 @@
                    (void)Var_Subst(cmd, gn, VARE_WANTRES|VARE_UNDEFERR, &cmd);
                    /* TODO: handle errors */
 
-                   if ((cp = strchr(cmd, '\n'))) {
+                   if ((cp = strchr(cmd, '\n')) != NULL) {
                        int n;
 
                        /*
diff -r 3ef9678885b4 -r 70afa6e5da58 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Thu Dec 31 16:19:05 2020 +0000
+++ b/usr.bin/make/parse.c      Thu Dec 31 17:39:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.524 2020/12/30 10:03:16 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.525 2020/12/31 17:39:36 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.524 2020/12/30 10:03:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.525 2020/12/31 17:39:36 rillig Exp $");
 
 /* types and constants */
 
@@ -2401,7 +2401,7 @@
        buf = curFile->readMore(curFile->readMoreArg, &len);
        if (buf == NULL) {
                /* Was all a waste of time ... */
-               if (curFile->fname)
+               if (curFile->fname != NULL)
                        free(curFile->fname);
                free(curFile);
                return;



Home | Main Index | Thread Index | Old Index