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(1): eliminate boolean argument of Var_Export
details: https://anonhg.NetBSD.org/src/rev/4318bff3e16d
branches: trunk
changeset: 947179:4318bff3e16d
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Dec 12 21:20:30 2020 +0000
description:
make(1): eliminate boolean argument of Var_Export
diffstat:
usr.bin/make/nonints.h | 5 +++--
usr.bin/make/parse.c | 8 ++++----
usr.bin/make/var.c | 20 +++++++++++++-------
3 files changed, 20 insertions(+), 13 deletions(-)
diffs (111 lines):
diff -r 47af1134d3cc -r 4318bff3e16d usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h Sat Dec 12 20:00:51 2020 +0000
+++ b/usr.bin/make/nonints.h Sat Dec 12 21:20:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.167 2020/12/12 18:53:53 rillig Exp $ */
+/* $NetBSD: nonints.h,v 1.168 2020/12/12 21:20:30 rillig Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
@@ -324,7 +324,8 @@
void Var_Stats(void);
void Var_Dump(GNode *);
void Var_ReexportVars(void);
-void Var_Export(const char *, Boolean);
+void Var_Export(const char *);
+void Var_ExportVars(const char *);
void Var_UnExport(const char *);
/* util.c */
diff -r 47af1134d3cc -r 4318bff3e16d usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Sat Dec 12 20:00:51 2020 +0000
+++ b/usr.bin/make/parse.c Sat Dec 12 21:20:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.472 2020/12/06 20:33:44 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.473 2020/12/12 21:20:30 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.472 2020/12/06 20:33:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.473 2020/12/12 21:20:30 rillig Exp $");
/* types and constants */
@@ -2042,7 +2042,7 @@
} else if (strcmp(name, MAKE_JOB_PREFIX) == 0)
Job_SetPrefix();
else if (strcmp(name, MAKE_EXPORTED) == 0)
- Var_Export(avalue, FALSE);
+ Var_ExportVars(avalue);
}
/* Perform the variable variable assignment in the given context. */
@@ -2983,7 +2983,7 @@
} else if (strncmp(cp, "export", 6) == 0) {
cp += 6;
pp_skip_whitespace(&cp);
- Var_Export(cp, TRUE);
+ Var_Export(cp);
return TRUE;
} else if (strncmp(cp, "unexport", 8) == 0) {
Var_UnExport(cp);
diff -r 47af1134d3cc -r 4318bff3e16d usr.bin/make/var.c
--- a/usr.bin/make/var.c Sat Dec 12 20:00:51 2020 +0000
+++ b/usr.bin/make/var.c Sat Dec 12 21:20:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.728 2020/12/12 20:00:51 rillig Exp $ */
+/* $NetBSD: var.c,v 1.729 2020/12/12 21:20:30 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.728 2020/12/12 20:00:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.729 2020/12/12 21:20:30 rillig Exp $");
/* A string that may need to be freed after use. */
typedef struct FStr {
@@ -714,26 +714,32 @@
* str has the format "[-env|-literal] varname...".
*/
void
-Var_Export(const char *str, Boolean isExport)
+Var_Export(const char *str)
{
VarExportFlags flags;
- if (isExport && str[0] == '\0') {
+ if (str[0] == '\0') {
var_exportedVars = VAR_EXPORTED_ALL; /* use with caution! */
return;
}
- if (isExport && strncmp(str, "-env", 4) == 0) {
+ if (strncmp(str, "-env", 4) == 0) {
str += 4;
flags = VAR_EXPORT_NORMAL;
- } else if (isExport && strncmp(str, "-literal", 8) == 0) {
+ } else if (strncmp(str, "-literal", 8) == 0) {
str += 8;
flags = VAR_EXPORT_LITERAL;
} else {
flags = VAR_EXPORT_PARENT;
}
- ExportVarsExpand(str, isExport, flags);
+ ExportVarsExpand(str, TRUE, flags);
+}
+
+void
+Var_ExportVars(const char *varnames)
+{
+ ExportVarsExpand(varnames, FALSE, VAR_EXPORT_PARENT);
}
Home |
Main Index |
Thread Index |
Old Index