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 += 1 with ++ and -= 1 with --



details:   https://anonhg.NetBSD.org/src/rev/404694463e92
branches:  trunk
changeset: 955428:404694463e92
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Sep 28 23:13:57 2020 +0000

description:
make(1): replace += 1 with ++ and -= 1 with --

Just for visual consistency.  The generated code stays exactly the same.

diffstat:

 usr.bin/make/compat.c |   6 ++--
 usr.bin/make/cond.c   |   6 ++--
 usr.bin/make/dir.c    |  54 +++++++++++++++++++++++++-------------------------
 usr.bin/make/job.c    |  10 ++++----
 usr.bin/make/make.c   |  10 ++++----
 usr.bin/make/parse.c  |  10 ++++----
 usr.bin/make/suff.c   |  14 ++++++------
 7 files changed, 55 insertions(+), 55 deletions(-)

diffs (truncated from 447 to 300 lines):

diff -r a8bb4e85a3e3 -r 404694463e92 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Mon Sep 28 23:02:02 2020 +0000
+++ b/usr.bin/make/compat.c     Mon Sep 28 23:13:57 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.158 2020/09/28 22:23:35 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.159 2020/09/28 23:13:57 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -99,7 +99,7 @@
 #include    "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.158 2020/09/28 22:23:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.159 2020/09/28 23:13:57 rillig Exp $");
 
 static GNode       *curTarg = NULL;
 static void CompatInterrupt(int);
@@ -721,7 +721,7 @@
            printf("`%s' is up to date.\n", gn->name);
        } else if (gn->made == ABORTED) {
            printf("`%s' not remade because of errors.\n", gn->name);
-           errors += 1;
+           errors++;
        }
     }
 
diff -r a8bb4e85a3e3 -r 404694463e92 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Mon Sep 28 23:02:02 2020 +0000
+++ b/usr.bin/make/cond.c       Mon Sep 28 23:13:57 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.154 2020/09/28 20:46:11 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.155 2020/09/28 23:13:57 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.154 2020/09/28 20:46:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.155 2020/09/28 23:13:57 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -642,7 +642,7 @@
        if (par->p[1] == '=') {
            par->p += 2;
        } else {
-           par->p += 1;
+           par->p++;
        }
        break;
     default:
diff -r a8bb4e85a3e3 -r 404694463e92 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Mon Sep 28 23:02:02 2020 +0000
+++ b/usr.bin/make/dir.c        Mon Sep 28 23:13:57 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.152 2020/09/28 22:23:35 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.153 2020/09/28 23:13:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -136,7 +136,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.152 2020/09/28 22:23:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.153 2020/09/28 23:13:57 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -375,12 +375,12 @@
         * Keep this one around too.
         */
        if ((dir = Dir_AddDir(NULL, cdname))) {
-           dir->refCount += 1;
+           dir->refCount++;
            if (cur && cur != dir) {
                /*
                 * We've been here before, cleanup.
                 */
-               cur->refCount -= 1;
+               cur->refCount--;
                Dir_Destroy(cur);
            }
            cur = dir;
@@ -412,7 +412,7 @@
      * We always need to have dot around, so we increment its reference count
      * to make sure it's not destroyed.
      */
-    dot->refCount += 1;
+    dot->refCount++;
     Dir_SetPATH();             /* initialize */
 }
 
@@ -422,11 +422,11 @@
 {
 #ifdef CLEANUP
     if (cur) {
-       cur->refCount -= 1;
+       cur->refCount--;
        Dir_Destroy(cur);
     }
-    dot->refCount -= 1;
-    dotLast->refCount -= 1;
+    dot->refCount--;
+    dotLast->refCount--;
     Dir_Destroy(dotLast);
     Dir_Destroy(dot);
     Dir_ClearPath(dirSearchPath);
@@ -900,8 +900,8 @@
 
     file = str_concat3(dir->name, "/", cp);
     DIR_DEBUG1("   returning %s\n", file);
-    dir->hits += 1;
-    hits += 1;
+    dir->hits++;
+    hits++;
     return file;
 }
 
@@ -938,7 +938,7 @@
     DIR_DEBUG1("checking %s ...\n", file);
 
     if (cached_stat(file, &mst) == 0) {
-       nearmisses += 1;
+       nearmisses++;
        return file;
     }
     free(file);
@@ -987,8 +987,8 @@
        return bmake_strdup("");
     }
 
-    dir->hits += 1;
-    hits += 1;
+    dir->hits++;
+    hits++;
     DIR_DEBUG1("   returning %s\n", name);
     return bmake_strdup(name);
 }
@@ -1012,14 +1012,14 @@
 
     if (Hash_FindEntry(&dot->files, cp) != NULL) {
        DIR_DEBUG0("   in '.'\n");
-       hits += 1;
-       dot->hits += 1;
+       hits++;
+       dot->hits++;
        return bmake_strdup(name);
     }
     if (cur && Hash_FindEntry(&cur->files, cp) != NULL) {
        DIR_DEBUG1("   in ${.CURDIR} = %s\n", cur->name);
-       hits += 1;
-       cur->hits += 1;
+       hits++;
+       cur->hits++;
        return str_concat3(cur->name, "/", cp);
     }
 
@@ -1067,7 +1067,7 @@
     base = strrchr(name, '/');
     if (base) {
        hasSlash = TRUE;
-       base += 1;
+       base++;
     } else {
        hasSlash = FALSE;
        base = name;
@@ -1077,7 +1077,7 @@
 
     if (path == NULL) {
        DIR_DEBUG0("couldn't open path, file not found\n");
-       misses += 1;
+       misses++;
        return NULL;
     }
 
@@ -1149,7 +1149,7 @@
      */
     if (!hasSlash) {
        DIR_DEBUG0("   failed.\n");
-       misses += 1;
+       misses++;
        return NULL;
     }
 
@@ -1277,13 +1277,13 @@
 #ifdef notdef
     if (base == trailing_dot) {
        base = strrchr(name, '/');
-       base += 1;
+       base++;
     }
     base[-1] = '\0';
     (void)Dir_AddDir(path, name);
     base[-1] = '/';
 
-    bigmisses += 1;
+    bigmisses++;
     ln = Lst_Last(path);
     if (ln == NULL) {
        return NULL;
@@ -1299,7 +1299,7 @@
 #else /* !notdef */
     DIR_DEBUG1("   Looking for \"%s\" ...\n", name);
 
-    bigmisses += 1;
+    bigmisses++;
     if (cached_stat(name, &mst) == 0) {
        return bmake_strdup(name);
     }
@@ -1508,7 +1508,7 @@
     if (ln != NULL) {
        dir = LstNode_Datum(ln);
        if (Lst_FindDatum(path, dir) == NULL) {
-           dir->refCount += 1;
+           dir->refCount++;
            Lst_Append(path, dir);
        }
        return dir;
@@ -1559,7 +1559,7 @@
 Dir_CopyDir(void *p)
 {
     CachedDir *dir = (CachedDir *)p;
-    dir->refCount += 1;
+    dir->refCount++;
 
     return p;
 }
@@ -1627,7 +1627,7 @@
 Dir_Destroy(void *dirp)
 {
     CachedDir *dir = dirp;
-    dir->refCount -= 1;
+    dir->refCount--;
 
     if (dir->refCount == 0) {
        CachedDirListNode *node;
@@ -1695,7 +1695,7 @@
     for (ln = path2->first; ln != NULL; ln = ln->next) {
        CachedDir *dir = ln->datum;
        if (Lst_FindDatum(path1, dir) == NULL) {
-           dir->refCount += 1;
+           dir->refCount++;
            Lst_Append(path1, dir);
        }
     }
diff -r a8bb4e85a3e3 -r 404694463e92 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Mon Sep 28 23:02:02 2020 +0000
+++ b/usr.bin/make/job.c        Mon Sep 28 23:13:57 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.251 2020/09/28 22:23:35 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.252 2020/09/28 23:13:57 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.251 2020/09/28 22:23:35 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.252 2020/09/28 23:13:57 rillig Exp $");
 
 # define STATIC static
 
@@ -634,7 +634,7 @@
    (void)fprintf(job->cmdFILE, fmt, arg);      \
    (void)fflush(job->cmdFILE);
 
-    numCommands += 1;
+    numCommands++;
 
     Var_Subst(cmd, job->node, VARE_WANTRES, &cmd);
     /* TODO: handle errors */
@@ -997,7 +997,7 @@
        Make_Update(job->node);
        job->job_state = JOB_ST_FREE;
     } else if (status != 0) {
-       errors += 1;
+       errors++;
        job->job_state = JOB_ST_FREE;
     }
 
@@ -2327,7 +2327,7 @@
        if (path == NULL) {
            path = UNCONST(shellPath);
        } else {
-           path += 1;
+           path++;
        }
        if (newShell.name != NULL) {
            shellName = newShell.name;
diff -r a8bb4e85a3e3 -r 404694463e92 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Mon Sep 28 23:02:02 2020 +0000
+++ b/usr.bin/make/make.c       Mon Sep 28 23:13:57 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.155 2020/09/28 23:02:02 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.156 2020/09/28 23:13:57 rillig Exp $        */



Home | Main Index | Thread Index | Old Index