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: inline macro for variable name ".MAKE.EXP...
details: https://anonhg.NetBSD.org/src/rev/4af4c4722c21
branches: trunk
changeset: 373533:4af4c4722c21
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Feb 15 06:31:51 2023 +0000
description:
make: inline macro for variable name ".MAKE.EXPORTED"
The variable name is distinctive enough to be searched directly in the
code instead of having a named constant for it.
No binary change.
diffstat:
usr.bin/make/make.h | 3 +--
usr.bin/make/parse.c | 6 +++---
usr.bin/make/var.c | 19 +++++++++----------
3 files changed, 13 insertions(+), 15 deletions(-)
diffs (122 lines):
diff -r 53c598ecdcf1 -r 4af4c4722c21 usr.bin/make/make.h
--- a/usr.bin/make/make.h Wed Feb 15 01:55:16 2023 +0000
+++ b/usr.bin/make/make.h Wed Feb 15 06:31:51 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.314 2023/02/14 21:56:47 rillig Exp $ */
+/* $NetBSD: make.h,v 1.315 2023/02/15 06:31:51 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -612,7 +612,6 @@
#define MAKEOVERRIDES ".MAKEOVERRIDES"
/* prefix when printing the target of a job */
#define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX"
-#define MAKE_EXPORTED ".MAKE.EXPORTED" /* exported variables */
#define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all loaded makefiles */
#define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */
#define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE"
diff -r 53c598ecdcf1 -r 4af4c4722c21 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c Wed Feb 15 01:55:16 2023 +0000
+++ b/usr.bin/make/parse.c Wed Feb 15 06:31:51 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.694 2023/02/14 21:38:31 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.695 2023/02/15 06:31:51 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.694 2023/02/14 21:38:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.695 2023/02/15 06:31:51 rillig Exp $");
/*
* A file being read.
@@ -1882,7 +1882,7 @@
Dir_SetPATH();
} else if (strcmp(name, MAKE_JOB_PREFIX) == 0)
Job_SetPrefix();
- else if (strcmp(name, MAKE_EXPORTED) == 0)
+ else if (strcmp(name, ".MAKE.EXPORTED") == 0)
Var_ExportVars(avalue);
}
diff -r 53c598ecdcf1 -r 4af4c4722c21 usr.bin/make/var.c
--- a/usr.bin/make/var.c Wed Feb 15 01:55:16 2023 +0000
+++ b/usr.bin/make/var.c Wed Feb 15 06:31:51 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.1044 2023/02/14 21:56:47 rillig Exp $ */
+/* $NetBSD: var.c,v 1.1045 2023/02/15 06:31:51 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.1044 2023/02/14 21:56:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1045 2023/02/15 06:31:51 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -521,7 +521,7 @@
if (v->exported)
unsetenv(v->name.str);
- if (strcmp(v->name.str, MAKE_EXPORTED) == 0)
+ if (strcmp(v->name.str, ".MAKE.EXPORTED") == 0)
var_exportedVars = VAR_EXPORTED_NONE;
assert(v->name.freeIt == NULL);
@@ -719,7 +719,7 @@
return;
}
- xvarnames = Var_Subst("${" MAKE_EXPORTED ":O:u}", SCOPE_GLOBAL,
+ xvarnames = Var_Subst("${.MAKE.EXPORTED:O:u}", SCOPE_GLOBAL,
VARE_WANTRES);
/* TODO: handle errors */
if (xvarnames[0] != '\0') {
@@ -752,7 +752,7 @@
var_exportedVars = VAR_EXPORTED_SOME;
if (isExport && mode == VEM_PLAIN)
- Global_Append(MAKE_EXPORTED, varname);
+ Global_Append(".MAKE.EXPORTED", varname);
}
Words_Free(words);
}
@@ -836,8 +836,7 @@
}
if (what != UNEXPORT_NAMED) {
- /* Using .MAKE.EXPORTED */
- char *expanded = Var_Subst("${" MAKE_EXPORTED ":O:u}",
+ char *expanded = Var_Subst("${.MAKE.EXPORTED:O:u}",
SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
varnames = FStr_InitOwn(expanded);
@@ -867,11 +866,11 @@
if (what == UNEXPORT_NAMED) {
/* Remove the variable names from .MAKE.EXPORTED. */
/* XXX: v->name is injected without escaping it */
- char *expr = str_concat3("${" MAKE_EXPORTED ":N",
+ char *expr = str_concat3("${.MAKE.EXPORTED:N",
v->name.str, "}");
char *cp = Var_Subst(expr, SCOPE_GLOBAL, VARE_WANTRES);
/* TODO: handle errors */
- Global_Set(MAKE_EXPORTED, cp);
+ Global_Set(".MAKE.EXPORTED", cp);
free(cp);
free(expr);
}
@@ -892,7 +891,7 @@
SubstringWords_Free(words);
if (what != UNEXPORT_NAMED)
- Global_Delete(MAKE_EXPORTED);
+ Global_Delete(".MAKE.EXPORTED");
}
/*
Home |
Main Index |
Thread Index |
Old Index