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 Var_SetWithFlags to Var_SetExpandW...



details:   https://anonhg.NetBSD.org/src/rev/22cef1653ddb
branches:  trunk
changeset: 959199:22cef1653ddb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Feb 04 19:15:13 2021 +0000

description:
make: rename Var_SetWithFlags to Var_SetExpandWithFlags

Add back Var_SetWithFlags for the one call that doesn't need to expand
the name.

Now one of the flags is encoded in the function name while the others
are encoded in VarSetFlags.  This is inconsistent.  Maybe there is a
better way to model the different variants of setting a variable.

diffstat:

 usr.bin/make/nonints.h |   3 ++-
 usr.bin/make/var.c     |  18 +++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diffs (72 lines):

diff -r 59987ab1d63e -r 22cef1653ddb usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Thu Feb 04 19:00:45 2021 +0000
+++ b/usr.bin/make/nonints.h    Thu Feb 04 19:15:13 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.197 2021/02/04 19:00:45 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.198 2021/02/04 19:15:13 rillig Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -376,6 +376,7 @@
 void Var_Set(const char *, const char *, GNode *);
 void Var_SetExpand(const char *, const char *, GNode *);
 void Var_SetWithFlags(const char *, const char *, GNode *, VarSetFlags);
+void Var_SetExpandWithFlags(const char *, const char *, GNode *, VarSetFlags);
 void Var_Append(const char *, const char *, GNode *);
 void Var_AppendExpand(const char *, const char *, GNode *);
 void Global_Append(const char *, const char *);
diff -r 59987ab1d63e -r 22cef1653ddb usr.bin/make/var.c
--- a/usr.bin/make/var.c        Thu Feb 04 19:00:45 2021 +0000
+++ b/usr.bin/make/var.c        Thu Feb 04 19:15:13 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.798 2021/02/04 19:00:45 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.799 2021/02/04 19:15:13 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.798 2021/02/04 19:00:45 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.799 2021/02/04 19:15:13 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -1001,9 +1001,16 @@
                VarFreeEnv(v, TRUE);
 }
 
+void
+Var_SetWithFlags(const char *name, const char *val, GNode *ctxt,
+                VarSetFlags flags)
+{
+       SetVar(name, val, ctxt, flags);
+}
+
 /* See Var_Set for documentation. */
 void
-Var_SetWithFlags(const char *name, const char *val, GNode *ctxt,
+Var_SetExpandWithFlags(const char *name, const char *val, GNode *ctxt,
                 VarSetFlags flags)
 {
        const char *unexpanded_name = name;
@@ -1048,7 +1055,7 @@
 void
 Var_SetExpand(const char *name, const char *val, GNode *ctxt)
 {
-       Var_SetWithFlags(name, val, ctxt, VAR_SET_NONE);
+       Var_SetExpandWithFlags(name, val, ctxt, VAR_SET_NONE);
 }
 
 void
@@ -1675,7 +1682,8 @@
                return;
 
        args = data;
-       Var_SetWithFlags(args->tvar, word, args->ctx, VAR_SET_NO_EXPORT);
+       /* XXX: The variable name should not be expanded here. */
+       Var_SetExpandWithFlags(args->tvar, word, args->ctx, VAR_SET_NO_EXPORT);
        (void)Var_Subst(args->str, args->ctx, args->eflags, &s);
        /* TODO: handle errors */
 



Home | Main Index | Thread Index | Old Index