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: rename Var_Delete to Var_DeleteExpand, Va...



details:   https://anonhg.NetBSD.org/src/rev/1e7be7b114e4
branches:  trunk
changeset: 959182:1e7be7b114e4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Feb 03 15:08:17 2021 +0000

description:
make: rename Var_Delete to Var_DeleteExpand, Var_DeleteVar to Var_Delete

The function names now follow the naming scheme from the other functions
that handle variables.

There are several calls that remain syntactically unchanged but that
omit the call to strchr('$') now.  Since all these calls use constant
variable names, there is no functional change.

diffstat:

 usr.bin/make/meta.c    |   6 +++---
 usr.bin/make/nonints.h |   4 ++--
 usr.bin/make/var.c     |  20 +++++++++++---------
 3 files changed, 16 insertions(+), 14 deletions(-)

diffs (122 lines):

diff -r 48edeb933577 -r 1e7be7b114e4 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Wed Feb 03 14:44:32 2021 +0000
+++ b/usr.bin/make/meta.c       Wed Feb 03 15:08:17 2021 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.173 2021/02/03 13:53:12 rillig Exp $ */
+/*      $NetBSD: meta.c,v 1.174 2021/02/03 15:08:17 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -1251,8 +1251,8 @@
                /* Process according to record type. */
                switch (buf[0]) {
                case 'X':               /* eXit */
-                   Var_Delete(lcwd_vname, VAR_GLOBAL);
-                   Var_Delete(ldir_vname, VAR_GLOBAL);
+                   Var_DeleteExpand(lcwd_vname, VAR_GLOBAL);
+                   Var_DeleteExpand(ldir_vname, VAR_GLOBAL);
                    lastpid = 0;        /* no need to save ldir_vname */
                    break;
 
diff -r 48edeb933577 -r 1e7be7b114e4 usr.bin/make/nonints.h
--- a/usr.bin/make/nonints.h    Wed Feb 03 14:44:32 2021 +0000
+++ b/usr.bin/make/nonints.h    Wed Feb 03 15:08:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nonints.h,v 1.195 2021/02/03 14:33:09 rillig Exp $     */
+/*     $NetBSD: nonints.h,v 1.196 2021/02/03 15:08:17 rillig Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -368,8 +368,8 @@
        VEM_LITERAL
 } VarExportMode;
 
-void Var_DeleteVar(const char *, GNode *);
 void Var_Delete(const char *, GNode *);
+void Var_DeleteExpand(const char *, GNode *);
 void Var_Undef(const char *);
 void Global_Set(const char *, const char *);
 void Global_SetExpand(const char *, const char *);
diff -r 48edeb933577 -r 1e7be7b114e4 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Wed Feb 03 14:44:32 2021 +0000
+++ b/usr.bin/make/var.c        Wed Feb 03 15:08:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.796 2021/02/03 14:33:09 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.797 2021/02/03 15:08:17 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -100,7 +100,9 @@
  *
  *     Var_Parse       Parse a variable expression such as ${VAR:Mpattern}.
  *
- *     Var_Delete      Delete a variable.
+ *     Var_Delete
+ *     Var_DeleteExpand
+ *                     Delete a variable.
  *
  *     Var_ReexportVars
  *                     Export some or even all variables to the environment
@@ -135,7 +137,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.796 2021/02/03 14:33:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.797 2021/02/03 15:08:17 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -487,7 +489,7 @@
  * The variable name is kept as-is, it is not expanded.
  */
 void
-Var_DeleteVar(const char *varname, GNode *ctxt)
+Var_Delete(const char *varname, GNode *ctxt)
 {
        HashEntry *he = HashTable_FindEntry(&ctxt->vars, varname);
        Var *v;
@@ -514,7 +516,7 @@
  * The variable name is expanded once.
  */
 void
-Var_Delete(const char *name, GNode *ctxt)
+Var_DeleteExpand(const char *name, GNode *ctxt)
 {
        FStr varname = FStr_InitRefer(name);
 
@@ -526,7 +528,7 @@
                varname = FStr_InitOwn(expanded);
        }
 
-       Var_DeleteVar(varname.str, ctxt);
+       Var_Delete(varname.str, ctxt);
        FStr_Done(&varname);
 }
 
@@ -561,7 +563,7 @@
 
        for (i = 0; i < varnames.len; i++) {
                const char *varname = varnames.words[i];
-               Var_DeleteVar(varname, VAR_GLOBAL);
+               Var_Delete(varname, VAR_GLOBAL);
        }
 
        Words_Free(varnames);
@@ -952,7 +954,7 @@
                         * needed. Otherwise -V name may show the wrong value.
                         */
                        /* XXX: name is expanded for the second time */
-                       Var_Delete(name, VAR_GLOBAL);
+                       Var_DeleteExpand(name, VAR_GLOBAL);
                }
                VarAdd(name, val, ctxt, flags);
        } else {
@@ -2361,7 +2363,7 @@
            ModifyWords(val, ModifyWord_Loop, &args, st->oneBigWord, st->sep));
        st->sep = prev_sep;
        /* XXX: Consider restoring the previous variable instead of deleting. */
-       Var_Delete(args.tvar, st->ctxt);
+       Var_DeleteExpand(args.tvar, st->ctxt);
        free(args.tvar);
        free(args.str);
        return AMR_OK;



Home | Main Index | Thread Index | Old Index