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 local variables to be simpler



details:   https://anonhg.NetBSD.org/src/rev/945573613e67
branches:  trunk
changeset: 1029213:945573613e67
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 27 21:21:17 2021 +0000

description:
make: rename local variables to be simpler

No binary change.

diffstat:

 usr.bin/make/cond.c  |   14 ++--
 usr.bin/make/main.c  |   26 +++++-----
 usr.bin/make/parse.c |  128 +++++++++++++++++++++++++-------------------------
 3 files changed, 84 insertions(+), 84 deletions(-)

diffs (truncated from 514 to 300 lines):

diff -r 9c4f91f2e415 -r 945573613e67 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Mon Dec 27 20:59:59 2021 +0000
+++ b/usr.bin/make/cond.c       Mon Dec 27 21:21:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.307 2021/12/27 18:54:19 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.308 2021/12/27 21:21:17 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.307 2021/12/27 18:54:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.308 2021/12/27 21:21:17 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -399,7 +399,7 @@
                      Buffer *buf, FStr *inout_str)
 {
        VarEvalMode emode;
-       const char *nested_p;
+       const char *p;
        bool atStart;
        VarParseResult parseResult;
 
@@ -407,9 +407,9 @@
            : doEval ? VARE_UNDEFERR
            : VARE_PARSE_ONLY;
 
-       nested_p = par->p;
-       atStart = nested_p == start;
-       parseResult = Var_Parse(&nested_p, SCOPE_CMDLINE, emode, inout_str);
+       p = par->p;
+       atStart = p == start;
+       parseResult = Var_Parse(&p, SCOPE_CMDLINE, emode, inout_str);
        /* TODO: handle errors */
        if (inout_str->str == var_Error) {
                if (parseResult == VPR_ERR) {
@@ -433,7 +433,7 @@
                *inout_str = FStr_InitRefer(NULL);
                return false;
        }
-       par->p = nested_p;
+       par->p = p;
 
        /*
         * If the '$' started the string literal (which means no quotes), and
diff -r 9c4f91f2e415 -r 945573613e67 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Mon Dec 27 20:59:59 2021 +0000
+++ b/usr.bin/make/main.c       Mon Dec 27 21:21:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.551 2021/12/27 20:59:59 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.552 2021/12/27 21:21: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.551 2021/12/27 20:59:59 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.552 2021/12/27 21:21:17 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -1429,21 +1429,21 @@
 
        /* Set some other useful variables. */
        {
-               char tmp[64], *ep = getenv(MAKE_LEVEL_ENV);
+               char buf[64], *ep = getenv(MAKE_LEVEL_ENV);
 
                makelevel = ep != NULL && ep[0] != '\0' ? atoi(ep) : 0;
                if (makelevel < 0)
                        makelevel = 0;
-               snprintf(tmp, sizeof tmp, "%d", makelevel);
-               Global_Set(MAKE_LEVEL, tmp);
-               snprintf(tmp, sizeof tmp, "%u", myPid);
-               Global_Set(".MAKE.PID", tmp);
-               snprintf(tmp, sizeof tmp, "%u", getppid());
-               Global_Set(".MAKE.PPID", tmp);
-               snprintf(tmp, sizeof tmp, "%u", getuid());
-               Global_Set(".MAKE.UID", tmp);
-               snprintf(tmp, sizeof tmp, "%u", getgid());
-               Global_Set(".MAKE.GID", tmp);
+               snprintf(buf, sizeof buf, "%d", makelevel);
+               Global_Set(MAKE_LEVEL, buf);
+               snprintf(buf, sizeof buf, "%u", myPid);
+               Global_Set(".MAKE.PID", buf);
+               snprintf(buf, sizeof buf, "%u", getppid());
+               Global_Set(".MAKE.PPID", buf);
+               snprintf(buf, sizeof buf, "%u", getuid());
+               Global_Set(".MAKE.UID", buf);
+               snprintf(buf, sizeof buf, "%u", getgid());
+               Global_Set(".MAKE.GID", buf);
        }
        if (makelevel > 0) {
                char pn[1024];
diff -r 9c4f91f2e415 -r 945573613e67 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Mon Dec 27 20:59:59 2021 +0000
+++ b/usr.bin/make/parse.c      Mon Dec 27 21:21:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.586 2021/12/27 19:06:07 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.587 2021/12/27 21:21: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.586 2021/12/27 19:06:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.587 2021/12/27 21:21:17 rillig Exp $");
 
 /* types and constants */
 
@@ -842,7 +842,7 @@
 }
 
 static bool
-ParseDependencySourceKeyword(const char *src, ParseSpecial specType)
+ParseDependencySourceKeyword(const char *src, ParseSpecial special)
 {
        int keywd;
        GNodeType op;
@@ -860,7 +860,7 @@
                return true;
        }
        if (parseKeywords[keywd].spec == SP_WAIT) {
-               ParseDependencySourceWait(specType != SP_NOT);
+               ParseDependencySourceWait(special != SP_NOT);
                return true;
        }
        return false;
@@ -916,7 +916,7 @@
 
 static void
 ParseDependencySourceOther(const char *src, GNodeType tOp,
-                          ParseSpecial specType)
+                          ParseSpecial special)
 {
        GNode *gn;
 
@@ -938,7 +938,7 @@
        if (tOp != OP_NONE)
                gn->type |= tOp;
        else
-               LinkToTargets(gn, specType != SP_NOT);
+               LinkToTargets(gn, special != SP_NOT);
 }
 
 /*
@@ -953,17 +953,17 @@
  *     src             name of the source to handle
  */
 static void
-ParseDependencySource(GNodeType tOp, const char *src, ParseSpecial specType)
+ParseDependencySource(GNodeType tOp, const char *src, ParseSpecial special)
 {
-       if (ParseDependencySourceKeyword(src, specType))
+       if (ParseDependencySourceKeyword(src, special))
                return;
 
-       if (specType == SP_MAIN)
+       if (special == SP_MAIN)
                ParseDependencySourceMain(src);
-       else if (specType == SP_ORDER)
+       else if (special == SP_ORDER)
                ParseDependencySourceOrder(src);
        else
-               ParseDependencySourceOther(src, tOp, specType);
+               ParseDependencySourceOther(src, tOp, special);
 }
 
 /*
@@ -1060,11 +1060,11 @@
  * See the tests deptgt-*.mk.
  */
 static void
-ParseDependencyTargetSpecial(ParseSpecial *inout_specType,
+ParseDependencyTargetSpecial(ParseSpecial *inout_special,
                             const char *targetName,
                             SearchPathList **inout_paths)
 {
-       switch (*inout_specType) {
+       switch (*inout_special) {
        case SP_PATH:
                if (*inout_paths == NULL)
                        *inout_paths = Lst_New();
@@ -1076,7 +1076,7 @@
                 * .MAIN node.
                 */
                if (!Lst_IsEmpty(&opts.create))
-                       *inout_specType = SP_NOT;
+                       *inout_special = SP_NOT;
                break;
        case SP_BEGIN:
        case SP_END:
@@ -1146,11 +1146,11 @@
 }
 
 /*
- * See if it's a special target and if so set specType to match it.
+ * See if it's a special target and if so set inout_special to match it.
  */
 static bool
 ParseDependencyTarget(const char *targetName,
-                     ParseSpecial *inout_specType,
+                     ParseSpecial *inout_special,
                      GNodeType *out_tOp, SearchPathList **inout_paths)
 {
        int keywd;
@@ -1164,20 +1164,20 @@
         */
        keywd = ParseFindKeyword(targetName);
        if (keywd != -1) {
-               if (*inout_specType == SP_PATH &&
+               if (*inout_special == SP_PATH &&
                    parseKeywords[keywd].spec != SP_PATH) {
                        Parse_Error(PARSE_FATAL, "Mismatched special targets");
                        return false;
                }
 
-               *inout_specType = parseKeywords[keywd].spec;
+               *inout_special = parseKeywords[keywd].spec;
                *out_tOp = parseKeywords[keywd].op;
 
-               ParseDependencyTargetSpecial(inout_specType, targetName,
+               ParseDependencyTargetSpecial(inout_special, targetName,
                    inout_paths);
 
        } else if (strncmp(targetName, ".PATH", 5) == 0) {
-               *inout_specType = SP_PATH;
+               *inout_special = SP_PATH;
                if (!ParseDependencyTargetPath(targetName + 5, inout_paths))
                        return false;
        }
@@ -1185,7 +1185,7 @@
 }
 
 static void
-ParseDependencyTargetMundane(char *targetName, StringList *curTargs)
+ParseDependencyTargetMundane(char *targetName, StringList *targetNames)
 {
        if (Dir_HasWildcards(targetName)) {
                /*
@@ -1196,7 +1196,7 @@
                 */
                SearchPath *emptyPath = SearchPath_New();
 
-               SearchPath_Expand(emptyPath, targetName, curTargs);
+               SearchPath_Expand(emptyPath, targetName, targetNames);
 
                SearchPath_Free(emptyPath);
        } else {
@@ -1204,13 +1204,13 @@
                 * No wildcards, but we want to avoid code duplication,
                 * so create a list with the word on it.
                 */
-               Lst_Append(curTargs, targetName);
+               Lst_Append(targetNames, targetName);
        }
 
        /* Apply the targets. */
 
-       while (!Lst_IsEmpty(curTargs)) {
-               char *targName = Lst_Dequeue(curTargs);
+       while (!Lst_IsEmpty(targetNames)) {
+               char *targName = Lst_Dequeue(targetNames);
                GNode *gn = Suff_IsTransform(targName)
                    ? Suff_AddTransform(targName)
                    : Targ_GetNode(targName);
@@ -1241,9 +1241,9 @@
 }
 
 static void
-ParseDependencyCheckSpec(ParseSpecial specType)
+ParseDependencyCheckSpecial(ParseSpecial special)
 {
-       switch (specType) {
+       switch (special) {
        case SP_DEFAULT:
        case SP_STALE:
        case SP_BEGIN:
@@ -1304,9 +1304,9 @@
  *     a .PATH removes all directories from the search path(s).
  */
 static void
-ParseDependencySourcesEmpty(ParseSpecial specType, SearchPathList *paths)
+ParseDependencySourcesEmpty(ParseSpecial special, SearchPathList *paths)
 {
-       switch (specType) {
+       switch (special) {
        case SP_SUFFIXES:
                Suff_ClearSuffixes();
                break;
@@ -1370,10 +1370,10 @@
  * and will cause make to do a new chdir to that path.



Home | Main Index | Thread Index | Old Index