Module Name: src
Committed By: rillig
Date: Sun Feb 14 13:46:01 UTC 2021
Modified Files:
src/usr.bin/make: var.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.811 -r1.812 src/usr.bin/make/var.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.811 src/usr.bin/make/var.c:1.812
--- src/usr.bin/make/var.c:1.811 Sun Feb 14 12:35:27 2021
+++ src/usr.bin/make/var.c Sun Feb 14 13:46:01 2021
@@ -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 @@ typedef struct ApplyModifiersState {
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 @@ ApplyModifier_Defined(const char **pp, c
}
*pp = p;
- ApplyModifiersState_Define(st);
+ Expr_Define(st);
if (eflags & VARE_WANTRES) {
st->newVal = FStr_InitOwn(Buf_DoneData(&buf));
@@ -2459,7 +2461,7 @@ ApplyModifier_Defined(const char **pp, c
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 @@ ApplyModifier_Path(const char **pp, Appl
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 @@ ApplyModifier_ShellCommand(const char **
Error(errfmt, cmd); /* XXX: why still return AMR_OK? */
free(cmd);
- ApplyModifiersState_Define(st);
+ Expr_Define(st);
return AMR_OK;
}
@@ -3223,7 +3225,7 @@ ApplyModifier_IfElse(const char **pp, Ap
st->newVal = FStr_InitOwn(else_expr);
free(then_expr);
}
- ApplyModifiersState_Define(st);
+ Expr_Define(st);
return AMR_OK;
}