Var_Delete: expand name if needed.
This commit is contained in:
parent
ccec91a1a9
commit
aea6f93e2d
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $ */
|
||||
/* $NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: var.c,v 1.173 2013/02/24 19:43:37 christos Exp $");
|
||||
__RCSID("$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -529,11 +529,20 @@ void
|
||||
Var_Delete(const char *name, GNode *ctxt)
|
||||
{
|
||||
Hash_Entry *ln;
|
||||
char *cp;
|
||||
|
||||
ln = Hash_FindEntry(&ctxt->context, name);
|
||||
if (strchr(name, '$')) {
|
||||
cp = Var_Subst(NULL, name, VAR_GLOBAL, 0);
|
||||
} else {
|
||||
cp = (char *)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;
|
||||
|
Loading…
Reference in New Issue
Block a user