make: remove unnecessary functions for expanding variable names
In meta mode, the affected variable patterns do not contain a '$'. Outside of meta mode, Global_SetExpand was only called a single time, so inline that call. No functional change.
This commit is contained in:
parent
ef57d9ef41
commit
2ae09f1b0c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.570 2022/01/15 18:34:41 rillig Exp $ */
|
||||
/* $NetBSD: main.c,v 1.571 2022/01/15 19:05:23 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -111,7 +111,7 @@
|
|||
#include "trace.h"
|
||||
|
||||
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.570 2022/01/15 18:34:41 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.571 2022/01/15 19:05:23 rillig Exp $");
|
||||
#if defined(MAKE_NATIVE) && !defined(lint)
|
||||
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
|
||||
"The Regents of the University of California. "
|
||||
|
@ -452,7 +452,7 @@ MainParseArg(char c, const char *argvalue)
|
|||
case 'D':
|
||||
if (argvalue[0] == '\0')
|
||||
return false;
|
||||
Global_SetExpand(argvalue, "1");
|
||||
Var_SetExpand(SCOPE_GLOBAL, argvalue, "1");
|
||||
Global_Append(MAKEFLAGS, "-D");
|
||||
Global_Append(MAKEFLAGS, argvalue);
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: meta.c,v 1.190 2022/01/15 18:34:41 rillig Exp $ */
|
||||
/* $NetBSD: meta.c,v 1.191 2022/01/15 19:05:23 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Implement 'meta' mode.
|
||||
|
@ -1268,8 +1268,8 @@ meta_oodate(GNode *gn, bool oodate)
|
|||
|
||||
if (lastpid > 0) {
|
||||
/* We need to remember these. */
|
||||
Global_SetExpand(lcwd_vname, lcwd);
|
||||
Global_SetExpand(ldir_vname, latestdir);
|
||||
Global_Set(lcwd_vname, lcwd);
|
||||
Global_Set(ldir_vname, latestdir);
|
||||
}
|
||||
snprintf(lcwd_vname, sizeof lcwd_vname, LCWD_VNAME_FMT, pid);
|
||||
snprintf(ldir_vname, sizeof ldir_vname, LDIR_VNAME_FMT, pid);
|
||||
|
@ -1302,8 +1302,8 @@ meta_oodate(GNode *gn, bool oodate)
|
|||
/* Process according to record type. */
|
||||
switch (buf[0]) {
|
||||
case 'X': /* eXit */
|
||||
Var_DeleteExpand(SCOPE_GLOBAL, lcwd_vname);
|
||||
Var_DeleteExpand(SCOPE_GLOBAL, ldir_vname);
|
||||
Var_Delete(SCOPE_GLOBAL, lcwd_vname);
|
||||
Var_Delete(SCOPE_GLOBAL, ldir_vname);
|
||||
lastpid = 0; /* no need to save ldir_vname */
|
||||
break;
|
||||
|
||||
|
@ -1315,9 +1315,9 @@ meta_oodate(GNode *gn, bool oodate)
|
|||
child = atoi(p);
|
||||
if (child > 0) {
|
||||
snprintf(cldir, sizeof cldir, LCWD_VNAME_FMT, child);
|
||||
Global_SetExpand(cldir, lcwd);
|
||||
Global_Set(cldir, lcwd);
|
||||
snprintf(cldir, sizeof cldir, LDIR_VNAME_FMT, child);
|
||||
Global_SetExpand(cldir, latestdir);
|
||||
Global_Set(cldir, latestdir);
|
||||
#ifdef DEBUG_META_MODE
|
||||
if (DEBUG(META))
|
||||
debug_printf(
|
||||
|
@ -1333,8 +1333,8 @@ meta_oodate(GNode *gn, bool oodate)
|
|||
/* Update lcwd and latest directory. */
|
||||
strlcpy(latestdir, p, sizeof latestdir);
|
||||
strlcpy(lcwd, p, sizeof lcwd);
|
||||
Global_SetExpand(lcwd_vname, lcwd);
|
||||
Global_SetExpand(ldir_vname, lcwd);
|
||||
Global_Set(lcwd_vname, lcwd);
|
||||
Global_Set(ldir_vname, lcwd);
|
||||
#ifdef DEBUG_META_MODE
|
||||
DEBUG4(META, "%s: %d: cwd=%s ldir=%s\n",
|
||||
fname, lineno, cwd, lcwd);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nonints.h,v 1.238 2022/01/15 18:34:41 rillig Exp $ */
|
||||
/* $NetBSD: nonints.h,v 1.239 2022/01/15 19:05:23 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -296,7 +296,6 @@ typedef enum VarExportMode {
|
|||
} VarExportMode;
|
||||
|
||||
void Var_Delete(GNode *, const char *);
|
||||
void Var_DeleteExpand(GNode *, const char *);
|
||||
void Var_Undef(const char *);
|
||||
void Var_Set(GNode *, const char *, const char *);
|
||||
void Var_SetExpand(GNode *, const char *, const char *);
|
||||
|
@ -319,7 +318,6 @@ void Var_ExportVars(const char *);
|
|||
void Var_UnExport(bool, const char *);
|
||||
|
||||
void Global_Set(const char *, const char *);
|
||||
void Global_SetExpand(const char *, const char *);
|
||||
void Global_Append(const char *, const char *);
|
||||
void Global_Delete(const char *);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: var.c,v 1.1001 2022/01/15 18:34:41 rillig Exp $ */
|
||||
/* $NetBSD: var.c,v 1.1002 2022/01/15 19:05:23 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -103,7 +103,6 @@
|
|||
* Var_Parse Parse a variable expression such as ${VAR:Mpattern}.
|
||||
*
|
||||
* Var_Delete
|
||||
* Var_DeleteExpand
|
||||
* Delete a variable.
|
||||
*
|
||||
* Var_ReexportVars
|
||||
|
@ -140,7 +139,7 @@
|
|||
#include "metachar.h"
|
||||
|
||||
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.1001 2022/01/15 18:34:41 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.1002 2022/01/15 19:05:23 rillig Exp $");
|
||||
|
||||
/*
|
||||
* Variables are defined using one of the VAR=value assignments. Their
|
||||
|
@ -521,20 +520,6 @@ Var_Delete(GNode *scope, const char *varname)
|
|||
free(v);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove a variable from a scope, freeing all related memory as well.
|
||||
* The variable name is expanded once.
|
||||
*/
|
||||
void
|
||||
Var_DeleteExpand(GNode *scope, const char *name)
|
||||
{
|
||||
FStr varname = FStr_InitRefer(name);
|
||||
|
||||
Var_Expand(&varname, SCOPE_GLOBAL, VARE_WANTRES);
|
||||
Var_Delete(scope, varname.str);
|
||||
FStr_Done(&varname);
|
||||
}
|
||||
|
||||
/*
|
||||
* Undefine one or more variables from the global scope.
|
||||
* The argument is expanded exactly once and then split into words.
|
||||
|
@ -1084,12 +1069,6 @@ Global_Set(const char *name, const char *value)
|
|||
Var_Set(SCOPE_GLOBAL, name, value);
|
||||
}
|
||||
|
||||
void
|
||||
Global_SetExpand(const char *name, const char *value)
|
||||
{
|
||||
Var_SetExpand(SCOPE_GLOBAL, name, value);
|
||||
}
|
||||
|
||||
void
|
||||
Global_Delete(const char *name)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue