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/c87a48312b77
branches:  trunk
changeset: 953620:c87a48312b77
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 15:19:15 2021 +0000

description:
make: separate parsing and evaluating for modifiers ':Q' and ':q'

No functional change.

diffstat:

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

diffs (39 lines):

diff -r 702e4e933692 -r c87a48312b77 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Mar 14 15:15:28 2021 +0000
+++ b/usr.bin/make/var.c        Sun Mar 14 15:19:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.860 2021/03/14 15:15:28 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.861 2021/03/14 15:19:15 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.860 2021/03/14 15:15:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.861 2021/03/14 15:19:15 rillig Exp $");
 
 typedef enum VarFlags {
        VFL_NONE        = 0,
@@ -2924,13 +2924,14 @@
 static ApplyModifierResult
 ApplyModifier_Quote(const char **pp, ApplyModifiersState *st)
 {
-       if (IsDelimiter((*pp)[1], st)) {
-               Expr_SetValueOwn(st->expr,
-                   VarQuote(st->expr->value.str, **pp == 'q'));
-               (*pp)++;
-               return AMR_OK;
-       } else
+       Boolean quoteDollar = **pp == 'q';
+       if (!IsDelimiter((*pp)[1], st))
                return AMR_UNKNOWN;
+       (*pp)++;
+
+       Expr_SetValueOwn(st->expr, VarQuote(st->expr->value.str, quoteDollar));
+
+       return AMR_OK;
 }
 
 /*ARGSUSED*/



Home | Main Index | Thread Index | Old Index