Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Var_Delete: expand name if needed.



details:   https://anonhg.NetBSD.org/src/rev/c5ff52815e99
branches:  trunk
changeset: 786886:c5ff52815e99
user:      sjg <sjg%NetBSD.org@localhost>
date:      Sat May 18 13:12:45 2013 +0000

description:
Var_Delete: expand name if needed.

diffstat:

 usr.bin/make/var.c |  21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 13dfe809c972 -r c5ff52815e99 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Fri May 17 23:04:37 2013 +0000
+++ b/usr.bin/make/var.c        Sat May 18 13:12:45 2013 +0000
@@ -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 @@
 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 = (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;



Home | Main Index | Thread Index | Old Index