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): extract UnexportVars from Var_UnExport
details: https://anonhg.NetBSD.org/src/rev/e2eba47489d1
branches: trunk
changeset: 1016931:e2eba47489d1
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Dec 06 17:35:51 2020 +0000
description:
make(1): extract UnexportVars from Var_UnExport
diffstat:
usr.bin/make/var.c | 36 +++++++++++++++++++-----------------
1 files changed, 19 insertions(+), 17 deletions(-)
diffs (64 lines):
diff -r 79f98a82bdd0 -r e2eba47489d1 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sun Dec 06 17:29:27 2020 +0000
+++ b/usr.bin/make/var.c Sun Dec 06 17:35:51 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.715 2020/12/06 17:27:10 rillig Exp $ */
+/* $NetBSD: var.c,v 1.716 2020/12/06 17:35:51 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.715 2020/12/06 17:27:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.716 2020/12/06 17:35:51 rillig Exp $");
/* A string that may need to be freed after use. */
typedef struct FStr {
@@ -810,6 +810,22 @@
}
}
+static void
+UnexportVars(FStr *varnames, UnexportWhat what)
+{
+ size_t i;
+
+ Words words = Str_Words(varnames->str, FALSE);
+ for (i = 0; i < words.len; i++) {
+ const char *varname = words.words[i];
+ UnexportVar(varname, what);
+ }
+ Words_Free(words);
+
+ if (what != UNEXPORT_NAMED)
+ Var_Delete(MAKE_EXPORTED, VAR_GLOBAL);
+}
+
/*
* This is called when .unexport[-env] is seen.
*
@@ -822,21 +838,7 @@
FStr varnames;
GetVarnamesToUnexport(str, &varnames, &what);
-
- {
- size_t i;
-
- Words words = Str_Words(varnames.str, FALSE);
- for (i = 0; i < words.len; i++) {
- const char *varname = words.words[i];
- UnexportVar(varname, what);
- }
- Words_Free(words);
-
- if (what != UNEXPORT_NAMED)
- Var_Delete(MAKE_EXPORTED, VAR_GLOBAL);
- }
-
+ UnexportVars(&varnames, what);
FStr_Done(&varnames);
}
Home |
Main Index |
Thread Index |
Old Index