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): skip redundant condExpr-- in CondGetSt...



details:   https://anonhg.NetBSD.org/src/rev/92ff7a3d6f90
branches:  trunk
changeset: 975997:92ff7a3d6f90
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Sep 10 23:27:27 2020 +0000

description:
make(1): skip redundant condExpr-- in CondGetString

diffstat:

 usr.bin/make/cond.c |  24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diffs (84 lines):

diff -r 0295839fbe81 -r 92ff7a3d6f90 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Thu Sep 10 22:51:10 2020 +0000
+++ b/usr.bin/make/cond.c       Thu Sep 10 23:27:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: cond.c,v 1.118 2020/09/10 22:47:22 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.119 2020/09/10 23:27:27 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -415,22 +415,23 @@
     *quoted = qt = *lex->condExpr == '"' ? 1 : 0;
     if (qt)
        lex->condExpr++;
-    for (start = lex->condExpr;
-        *lex->condExpr && str == NULL; lex->condExpr++) {
+    for (start = lex->condExpr; *lex->condExpr && str == NULL;) {
        switch (*lex->condExpr) {
        case '\\':
            if (lex->condExpr[1] != '\0') {
                lex->condExpr++;
                Buf_AddByte(&buf, *lex->condExpr);
            }
-           break;
+           lex->condExpr++;
+           continue;
        case '"':
            if (qt) {
                lex->condExpr++;        /* we don't want the quotes */
                goto got_str;
            } else
                Buf_AddByte(&buf, *lex->condExpr); /* likely? */
-           break;
+           lex->condExpr++;
+           continue;
        case ')':
        case '!':
        case '=':
@@ -442,7 +443,8 @@
                goto got_str;
            else
                Buf_AddByte(&buf, *lex->condExpr);
-           break;
+           lex->condExpr++;
+           continue;
        case '$':
            /* if we are in quotes, then an undefined variable is ok */
            eflags = ((!qt && doEval) ? VARE_UNDEFERR : 0) |
@@ -479,8 +481,7 @@
                *freeIt = NULL;
            }
            str = NULL;         /* not finished yet */
-           lex->condExpr--;    /* don't skip over next char */
-           break;
+           continue;
        default:
            if (strictLHS && !qt && *start != '$' &&
                !isdigit((unsigned char)*start)) {
@@ -493,7 +494,8 @@
                goto cleanup;
            }
            Buf_AddByte(&buf, *lex->condExpr);
-           break;
+           lex->condExpr++;
+           continue;
        }
     }
 got_str:



Home | Main Index | Thread Index | Old Index