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: replace pre-increment with post-increment...



details:   https://anonhg.NetBSD.org/src/rev/28b643373bbc
branches:  trunk
changeset: 950836:28b643373bbc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Feb 01 19:46:58 2021 +0000

description:
make: replace pre-increment with post-increment or simple addition

The rest of the code already prefers post-increment if there is no
actual difference.

diffstat:

 usr.bin/make/main.c |  10 +++++-----
 usr.bin/make/str.c  |   6 +++---
 usr.bin/make/util.c |   8 ++++----
 usr.bin/make/var.c  |   6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diffs (135 lines):

diff -r fbed51872306 -r 28b643373bbc usr.bin/make/main.c
--- a/usr.bin/make/main.c       Mon Feb 01 19:43:07 2021 +0000
+++ b/usr.bin/make/main.c       Mon Feb 01 19:46:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.522 2021/02/01 19:43:07 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.523 2021/02/01 19:46:58 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -111,7 +111,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.522 2021/02/01 19:43:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.523 2021/02/01 19:46:58 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -244,7 +244,7 @@
        const char *modules;
        DebugFlags debug = opts.debug;
 
-       for (modules = argvalue; *modules != '\0'; ++modules) {
+       for (modules = argvalue; *modules != '\0'; modules++) {
                switch (*modules) {
                case '0':       /* undocumented, only intended for tests */
                        debug = DEBUG_NONE;
@@ -652,7 +652,7 @@
         * perform them if so. Else take them to be targets and stuff them
         * on the end of the "create" list.
         */
-       for (; argc > 1; ++argv, --argc) {
+       for (; argc > 1; argv++, argc--) {
                VarAssign var;
                if (Parse_IsVar(argv[1], &var)) {
                        Parse_DoVar(&var, VAR_CMDLINE);
@@ -687,7 +687,7 @@
        if (line == NULL)
                return;
        /* XXX: don't use line as an iterator variable */
-       for (; *line == ' '; ++line)
+       for (; *line == ' '; line++)
                continue;
        if (line[0] == '\0')
                return;
diff -r fbed51872306 -r 28b643373bbc usr.bin/make/str.c
--- a/usr.bin/make/str.c        Mon Feb 01 19:43:07 2021 +0000
+++ b/usr.bin/make/str.c        Mon Feb 01 19:46:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: str.c,v 1.79 2021/01/19 20:51:46 rillig Exp $  */
+/*     $NetBSD: str.c,v 1.80 2021/02/01 19:46:58 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -71,7 +71,7 @@
 #include "make.h"
 
 /*     "@(#)str.c      5.8 (Berkeley) 6/1/90"  */
-MAKE_RCSID("$NetBSD: str.c,v 1.79 2021/01/19 20:51:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: str.c,v 1.80 2021/02/01 19:46:58 rillig Exp $");
 
 /* Return the concatenation of s1 and s2, freshly allocated. */
 char *
@@ -156,7 +156,7 @@
        inquote = '\0';
        word_start = words_buf;
        word_end = words_buf;
-       for (str_p = str;; ++str_p) {
+       for (str_p = str;; str_p++) {
                char ch = *str_p;
                switch (ch) {
                case '"':
diff -r fbed51872306 -r 28b643373bbc usr.bin/make/util.c
--- a/usr.bin/make/util.c       Mon Feb 01 19:43:07 2021 +0000
+++ b/usr.bin/make/util.c       Mon Feb 01 19:46:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.73 2020/12/30 10:03:16 rillig Exp $ */
+/*     $NetBSD: util.c,v 1.74 2021/02/01 19:46:58 rillig Exp $ */
 
 /*
  * Missing stuff from OS's
@@ -15,7 +15,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: util.c,v 1.73 2020/12/30 10:03:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: util.c,v 1.74 2021/02/01 19:46:58 rillig Exp $");
 
 #if !defined(MAKE_NATIVE) && !defined(HAVE_STRERROR)
 extern int errno, sys_nerr;
@@ -76,7 +76,7 @@
        }
 
        while (findenv(name, &offset))  { /* if set multiple times */
-               for (p = &environ[offset];; ++p)
+               for (p = &environ[offset];; p++)
                        if (!(*p = *(p + 1)))
                                break;
        }
@@ -124,7 +124,7 @@
                environ = savedEnv;
                environ[offset + 1] = NULL;
        }
-       for (cc = name; *cc && *cc != '='; ++cc)        /* no `=' in name */
+       for (cc = name; *cc && *cc != '='; cc++)        /* no `=' in name */
                continue;
        size = cc - name;
        /* name + `=' + value */
diff -r fbed51872306 -r 28b643373bbc usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Feb 01 19:43:07 2021 +0000
+++ b/usr.bin/make/var.c        Mon Feb 01 19:46:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.786 2021/01/30 21:25:10 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.787 2021/02/01 19:46:58 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.786 2021/01/30 21:25:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.787 2021/02/01 19:46:58 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -2162,7 +2162,7 @@
                return VPR_ERR;
        }
 
-       *pp = ++p;
+       *pp = p + 1;
        if (out_length != NULL)
                *out_length = buf.len;
 



Home | Main Index | Thread Index | Old Index