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: rename ApplyModifiersState_Define to Expr...



details:   https://anonhg.NetBSD.org/src/rev/99fecdeaf3e7
branches:  trunk
changeset: 1018699:99fecdeaf3e7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 14 13:46:01 2021 +0000

description:
make: rename ApplyModifiersState_Define to Expr_Define

The type name ApplyModifiersState was only intended as a working draft,
its name is too long and its scope a little too narrow.

Applying the modifiers is the main part of evaluating a variable
expression, and the scope of that type will be extended to parsing the
name of the expression as well.  This will hopefully reduce the number
of parameters, which is currently at 14.

No functional change.

diffstat:

 usr.bin/make/var.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (80 lines):

diff -r b098d1a03f20 -r 99fecdeaf3e7 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Feb 14 13:24:45 2021 +0000
+++ b/usr.bin/make/var.c        Sun Feb 14 13:46:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.811 2021/02/14 12:35:27 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.812 2021/02/14 13:46:01 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.811 2021/02/14 12:35:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.812 2021/02/14 13:46:01 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -2087,11 +2087,13 @@
        VarExprStatus exprStatus;
 } ApplyModifiersState;
 
+typedef ApplyModifiersState Expr;
+
 static void
-ApplyModifiersState_Define(ApplyModifiersState *st)
+Expr_Define(Expr *expr)
 {
-       if (st->exprStatus == VES_UNDEF)
-               st->exprStatus = VES_DEF;
+       if (expr->exprStatus == VES_UNDEF)
+               expr->exprStatus = VES_DEF;
 }
 
 typedef enum ApplyModifierResult {
@@ -2444,7 +2446,7 @@
        }
        *pp = p;
 
-       ApplyModifiersState_Define(st);
+       Expr_Define(st);
 
        if (eflags & VARE_WANTRES) {
                st->newVal = FStr_InitOwn(Buf_DoneData(&buf));
@@ -2459,7 +2461,7 @@
 static ApplyModifierResult
 ApplyModifier_Literal(const char **pp, ApplyModifiersState *st)
 {
-       ApplyModifiersState_Define(st);
+       Expr_Define(st);
        st->newVal = FStr_InitOwn(bmake_strdup(st->var->name.str));
        (*pp)++;
        return AMR_OK;
@@ -2556,7 +2558,7 @@
        GNode *gn;
        char *path;
 
-       ApplyModifiersState_Define(st);
+       Expr_Define(st);
 
        gn = Targ_FindNode(st->var->name.str);
        if (gn == NULL || gn->type & OP_NOPATH) {
@@ -2597,7 +2599,7 @@
                Error(errfmt, cmd);     /* XXX: why still return AMR_OK? */
        free(cmd);
 
-       ApplyModifiersState_Define(st);
+       Expr_Define(st);
        return AMR_OK;
 }
 
@@ -3223,7 +3225,7 @@
                st->newVal = FStr_InitOwn(else_expr);
                free(then_expr);
        }
-       ApplyModifiersState_Define(st);
+       Expr_Define(st);
        return AMR_OK;
 }
 



Home | Main Index | Thread Index | Old Index