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: add shortcut Global_Delete for deleting a...



details:   https://anonhg.NetBSD.org/src/rev/edabf726d73d
branches:  trunk
changeset: 959217:edabf726d73d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Feb 05 04:41:17 2021 +0000

description:
make: add shortcut Global_Delete for deleting a global variable

diffstat:

 usr.bin/make/dir.c     |   6 +++---
 usr.bin/make/main.c    |   6 +++---
 usr.bin/make/nonints.h |   3 ++-
 usr.bin/make/parse.c   |  16 ++++++++--------
 usr.bin/make/var.c     |  14 ++++++++++----
 5 files changed, 26 insertions(+), 19 deletions(-)

diffs (164 lines):

diff -r c09e468d1f63 -r edabf726d73d usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Fri Feb 05 03:27:58 2021 +0000
+++ b/usr.bin/make/dir.c        Fri Feb 05 04:41:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.268 2021/02/04 21:33:13 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.269 2021/02/05 04:41:17 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.268 2021/02/04 21:33:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.269 2021/02/05 04:41:17 rillig Exp $");
 
 /*
  * A search path is a list of CachedDir structures. A CachedDir has in it the
@@ -549,7 +549,7 @@
        CachedDirListNode *ln;
        Boolean seenDotLast = FALSE;    /* true if we should search '.' last */
 
-       Var_Delete(".PATH", SCOPE_GLOBAL);
+       Global_Delete(".PATH");
 
        if ((ln = dirSearchPath.dirs.first) != NULL) {
                CachedDir *dir = ln->datum;
diff -r c09e468d1f63 -r edabf726d73d usr.bin/make/main.c
--- a/usr.bin/make/main.c       Fri Feb 05 03:27:58 2021 +0000
+++ b/usr.bin/make/main.c       Fri Feb 05 04:41:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.530 2021/02/04 21:33:13 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.531 2021/02/05 04:41:17 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.530 2021/02/04 21:33:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.531 2021/02/05 04:41:17 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -2105,7 +2105,7 @@
         * We can print this even if there is no .ERROR target.
         */
        Global_Set(".ERROR_TARGET", gn->name);
-       Var_Delete(".ERROR_CMD", SCOPE_GLOBAL);
+       Global_Delete(".ERROR_CMD");
 
        for (ln = gn->commands.first; ln != NULL; ln = ln->next) {
                const char *cmd = ln->datum;
diff -r c09e468d1f63 -r edabf726d73d usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Fri Feb 05 03:27:58 2021 +0000
+++ b/usr.bin/make/nonints.h    Fri Feb 05 04:41:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.200 2021/02/04 21:50:39 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.201 2021/02/05 04:41:17 rillig Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -393,6 +393,7 @@
 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 *);
 
 /* util.c */
 typedef void (*SignalProc)(int);
diff -r c09e468d1f63 -r edabf726d73d usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Fri Feb 05 03:27:58 2021 +0000
+++ b/usr.bin/make/parse.c      Fri Feb 05 04:41:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.546 2021/02/04 21:42:46 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.547 2021/02/05 04:41:17 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.546 2021/02/04 21:42:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.547 2021/02/05 04:41:17 rillig Exp $");
 
 /* types and constants */
 
@@ -2321,8 +2321,8 @@
                SetFilenameVars(including,
                    ".INCLUDEDFROMDIR", ".INCLUDEDFROMFILE");
        } else {
-               Var_Delete(".INCLUDEDFROMDIR", SCOPE_GLOBAL);
-               Var_Delete(".INCLUDEDFROMFILE", SCOPE_GLOBAL);
+               Global_Delete(".INCLUDEDFROMDIR");
+               Global_Delete(".INCLUDEDFROMFILE");
        }
 }
 
@@ -2594,10 +2594,10 @@
 
        if (includes.len == 0) {
                /* We've run out of input */
-               Var_Delete(".PARSEDIR", SCOPE_GLOBAL);
-               Var_Delete(".PARSEFILE", SCOPE_GLOBAL);
-               Var_Delete(".INCLUDEDFROMDIR", SCOPE_GLOBAL);
-               Var_Delete(".INCLUDEDFROMFILE", SCOPE_GLOBAL);
+               Global_Delete(".PARSEDIR");
+               Global_Delete(".PARSEFILE");
+               Global_Delete(".INCLUDEDFROMDIR");
+               Global_Delete(".INCLUDEDFROMFILE");
                return FALSE;
        }
 
diff -r c09e468d1f63 -r edabf726d73d usr.bin/make/var.c
--- a/usr.bin/make/var.c        Fri Feb 05 03:27:58 2021 +0000
+++ b/usr.bin/make/var.c        Fri Feb 05 04:41:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.803 2021/02/04 21:50:39 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.804 2021/02/05 04:41:17 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.803 2021/02/04 21:50:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.804 2021/02/05 04:41:17 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -564,7 +564,7 @@
 
        for (i = 0; i < varnames.len; i++) {
                const char *varname = varnames.words[i];
-               Var_Delete(varname, SCOPE_GLOBAL);
+               Global_Delete(varname);
        }
 
        Words_Free(varnames);
@@ -898,7 +898,7 @@
        Words_Free(words);
 
        if (what != UNEXPORT_NAMED)
-               Var_Delete(MAKE_EXPORTED, SCOPE_GLOBAL);
+               Global_Delete(MAKE_EXPORTED);
 }
 
 /*
@@ -1063,6 +1063,12 @@
        Var_SetExpand(name, value, SCOPE_GLOBAL);
 }
 
+void
+Global_Delete(const char *name)
+{
+       Var_Delete(name, SCOPE_GLOBAL);
+}
+
 /*
  * Append the value to the named variable.
  *



Home | Main Index | Thread Index | Old Index