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 switch with if-else chain in C...



details:   https://anonhg.NetBSD.org/src/rev/cb54f62ab533
branches:  trunk
changeset: 945784:cb54f62ab533
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 07 14:18:25 2020 +0000

description:
make(1): replace switch with if-else chain in Compat_RunCommand

diffstat:

 usr.bin/make/compat.c |  19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diffs (45 lines):

diff -r ce7ce6373e25 -r cb54f62ab533 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sat Nov 07 14:11:58 2020 +0000
+++ b/usr.bin/make/compat.c     Sat Nov 07 14:18:25 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.176 2020/11/07 10:23:20 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.177 2020/11/07 14:18:25 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.176 2020/11/07 10:23:20 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.177 2020/11/07 14:18:25 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -220,20 +220,17 @@
        return 0;
     }
 
-    while (*cmd == '@' || *cmd == '-' || *cmd == '+') {
-       switch (*cmd) {
-       case '@':
+    for (;;) {
+       if (*cmd == '@')
            silent = !DEBUG(LOUD);
-           break;
-       case '-':
+       else if (*cmd == '-')
            errCheck = FALSE;
-           break;
-       case '+':
+       else if (*cmd == '+') {
            doIt = TRUE;
-           if (!shellName)             /* we came here from jobs */
+           if (!shellName)     /* we came here from jobs */
                Shell_Init();
+       } else
            break;
-       }
        cmd++;
     }
 



Home | Main Index | Thread Index | Old Index