Var_Delete: expand name to delete if needed.

This commit is contained in:
Simon J. Gerraty 2013-05-18 13:07:01 +00:00
parent 3f15ba3d2c
commit 6088328518
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250770

View File

@ -540,11 +540,20 @@ void
Var_Delete(const char *name, GNode *ctxt)
{
Hash_Entry *ln;
ln = Hash_FindEntry(&ctxt->context, name);
char *cp;
if (strchr(name, '$')) {
cp = Var_Subst(NULL, name, VAR_GLOBAL, 0);
} else {
cp = name;
}
ln = Hash_FindEntry(&ctxt->context, cp);
if (DEBUG(VAR)) {
fprintf(debug_file, "%s:delete %s%s\n",
ctxt->name, name, ln ? "" : " (not found)");
ctxt->name, cp, ln ? "" : " (not found)");
}
if (cp != name) {
free(cp);
}
if (ln != NULL) {
Var *v;