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): reduce line noise in Job_ParseShell



details:   https://anonhg.NetBSD.org/src/rev/d8fee7accee3
branches:  trunk
changeset: 976600:d8fee7accee3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 27 19:13:46 2020 +0000

description:
make(1): reduce line noise in Job_ParseShell

The generated code is exactly the same.

diffstat:

 usr.bin/make/job.c |  60 +++++++++++++++++++++++++++---------------------------
 1 files changed, 30 insertions(+), 30 deletions(-)

diffs (86 lines):

diff -r dc7a041b8411 -r d8fee7accee3 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sun Sep 27 19:08:11 2020 +0000
+++ b/usr.bin/make/job.c        Sun Sep 27 19:13:46 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.244 2020/09/27 19:06:47 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.245 2020/09/27 19:13:46 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -140,7 +140,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.244 2020/09/27 19:06:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.245 2020/09/27 19:13:46 rillig Exp $");
 
 # define STATIC static
 
@@ -2257,39 +2257,39 @@
     shellArgv = path;
 
     for (path = NULL, argv = words; argc != 0; argc--, argv++) {
-       if (strncmp(*argv, "path=", 5) == 0) {
-           path = &argv[0][5];
-       } else if (strncmp(*argv, "name=", 5) == 0) {
-           newShell.name = &argv[0][5];
+       char *arg = *argv;
+       if (strncmp(arg, "path=", 5) == 0) {
+           path = arg + 5;
+       } else if (strncmp(arg, "name=", 5) == 0) {
+           newShell.name = arg + 5;
        } else {
-           if (strncmp(*argv, "quiet=", 6) == 0) {
-               newShell.echoOff = &argv[0][6];
-           } else if (strncmp(*argv, "echo=", 5) == 0) {
-               newShell.echoOn = &argv[0][5];
-           } else if (strncmp(*argv, "filter=", 7) == 0) {
-               newShell.noPrint = &argv[0][7];
+           if (strncmp(arg, "quiet=", 6) == 0) {
+               newShell.echoOff = arg + 6;
+           } else if (strncmp(arg, "echo=", 5) == 0) {
+               newShell.echoOn = arg + 5;
+           } else if (strncmp(arg, "filter=", 7) == 0) {
+               newShell.noPrint = arg + 7;
                newShell.noPLen = strlen(newShell.noPrint);
-           } else if (strncmp(*argv, "echoFlag=", 9) == 0) {
-               newShell.echo = &argv[0][9];
-           } else if (strncmp(*argv, "errFlag=", 8) == 0) {
-               newShell.exit = &argv[0][8];
-           } else if (strncmp(*argv, "hasErrCtl=", 10) == 0) {
-               char c = argv[0][10];
+           } else if (strncmp(arg, "echoFlag=", 9) == 0) {
+               newShell.echo = arg + 9;
+           } else if (strncmp(arg, "errFlag=", 8) == 0) {
+               newShell.exit = arg + 8;
+           } else if (strncmp(arg, "hasErrCtl=", 10) == 0) {
+               char c = arg[10];
                newShell.hasErrCtl = !((c != 'Y') && (c != 'y') &&
                                       (c != 'T') && (c != 't'));
-           } else if (strncmp(*argv, "newline=", 8) == 0) {
-               newShell.newline = &argv[0][8];
-           } else if (strncmp(*argv, "check=", 6) == 0) {
-               newShell.errCheck = &argv[0][6];
-           } else if (strncmp(*argv, "ignore=", 7) == 0) {
-               newShell.ignErr = &argv[0][7];
-           } else if (strncmp(*argv, "errout=", 7) == 0) {
-               newShell.errOut = &argv[0][7];
-           } else if (strncmp(*argv, "comment=", 8) == 0) {
-               newShell.commentChar = argv[0][8];
+           } else if (strncmp(arg, "newline=", 8) == 0) {
+               newShell.newline = arg + 8;
+           } else if (strncmp(arg, "check=", 6) == 0) {
+               newShell.errCheck = arg + 6;
+           } else if (strncmp(arg, "ignore=", 7) == 0) {
+               newShell.ignErr = arg + 7;
+           } else if (strncmp(arg, "errout=", 7) == 0) {
+               newShell.errOut = arg + 7;
+           } else if (strncmp(arg, "comment=", 8) == 0) {
+               newShell.commentChar = arg[8];
            } else {
-               Parse_Error(PARSE_FATAL, "Unknown keyword \"%s\"",
-                           *argv);
+               Parse_Error(PARSE_FATAL, "Unknown keyword \"%s\"", arg);
                free(words);
                return FALSE;
            }



Home | Main Index | Thread Index | Old Index