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: separate parsing and evaluating for modif...



details:   https://anonhg.NetBSD.org/src/rev/d2ca2cfd5f31
branches:  trunk
changeset: 960310:d2ca2cfd5f31
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 15:22:21 2021 +0000

description:
make: separate parsing and evaluating for modifier ':u'

No functional change.

diffstat:

 usr.bin/make/var.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (47 lines):

diff -r 9b33900dc310 -r d2ca2cfd5f31 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Mar 14 15:19:15 2021 +0000
+++ b/usr.bin/make/var.c        Sun Mar 14 15:22:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.861 2021/03/14 15:19:15 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.862 2021/03/14 15:22:21 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.861 2021/03/14 15:19:15 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.862 2021/03/14 15:22:21 rillig Exp $");
 
 typedef enum VarFlags {
        VFL_NONE        = 0,
@@ -3329,8 +3329,8 @@
        if ((op[0] == '!' || op[0] == '+' || op[0] == '?') && op[1] == '=')
                goto ok;
        return AMR_UNKNOWN;     /* "::<unrecognised>" */
+
 ok:
-
        if (expr->var->name.str[0] == '\0') {
                *pp = mod + 1;
                return AMR_BAD;
@@ -3442,12 +3442,13 @@
 static ApplyModifierResult
 ApplyModifier_Unique(const char **pp, ApplyModifiersState *st)
 {
-       if (IsDelimiter((*pp)[1], st)) {
-               Expr_SetValueOwn(st->expr, VarUniq(st->expr->value.str));
-               (*pp)++;
-               return AMR_OK;
-       } else
+       if (!IsDelimiter((*pp)[1], st))
                return AMR_UNKNOWN;
+       (*pp)++;
+
+       Expr_SetValueOwn(st->expr, VarUniq(st->expr->value.str));
+
+       return AMR_OK;
 }
 
 #ifdef SYSVVARSUB



Home | Main Index | Thread Index | Old Index