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(1): use consistent variable names for list...



details:   https://anonhg.NetBSD.org/src/rev/a8cdd0d66f5c
branches:  trunk
changeset: 946604:a8cdd0d66f5c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Dec 04 14:39:56 2020 +0000

description:
make(1): use consistent variable names for list nodes

diffstat:

 usr.bin/make/arch.c |  22 +++++++++-------------
 usr.bin/make/dir.c  |  11 ++++++-----
 usr.bin/make/job.c  |  10 +++++-----
 usr.bin/make/lst.c  |  16 ++++++++--------
 usr.bin/make/targ.c |  22 +++++++++++++---------
 5 files changed, 41 insertions(+), 40 deletions(-)

diffs (252 lines):

diff -r 59ee110c12d8 -r a8cdd0d66f5c usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Fri Dec 04 14:28:50 2020 +0000
+++ b/usr.bin/make/arch.c       Fri Dec 04 14:39:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.182 2020/11/29 01:40:26 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.183 2020/12/04 14:39:56 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -125,7 +125,7 @@
 #include "config.h"
 
 /*     "@(#)arch.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: arch.c,v 1.182 2020/11/29 01:40:26 rillig Exp $");
+MAKE_RCSID("$NetBSD: arch.c,v 1.183 2020/12/04 14:39:56 rillig Exp $");
 
 typedef struct List ArchList;
 typedef struct ListNode ArchListNode;
@@ -169,21 +169,20 @@
 
 /*
  * Parse an archive specification such as "archive.a(member1 member2.${EXT})",
- * adding nodes for the expanded members to nodeLst.  Nodes are created as
+ * adding nodes for the expanded members to gns.  Nodes are created as
  * necessary.
  *
  * Input:
  *     pp              The start of the specification.
- *     nodeLst         The list on which to place the nodes.
+ *     gns             The list on which to place the nodes.
  *     ctxt            The context in which to expand variables.
  *
  * Output:
  *     return          TRUE if it was a valid specification.
  *     *pp             Points to the first non-space after the archive spec.
- *     *nodeLst        Nodes for the members have been added.
  */
 Boolean
-Arch_ParseArchive(char **pp, GNodeList *nodeLst, GNode *ctxt)
+Arch_ParseArchive(char **pp, GNodeList *gns, GNode *ctxt)
 {
        char *cp;               /* Pointer into line */
        GNode *gn;              /* New node */
@@ -317,8 +316,6 @@
                        /*
                         * Now form an archive spec and recurse to deal with
                         * nested variables and multi-word variable values.
-                        * The results are just placed at the end of the
-                        * nodeLst we're returning.
                         */
                        sacrifice = str_concat4(libName, "(", memName, ")");
                        buf = sacrifice;
@@ -333,10 +330,9 @@
                                 */
                                gn = Targ_GetNode(buf);
                                gn->type |= OP_ARCHV;
-                               Lst_Append(nodeLst, gn);
+                               Lst_Append(gns, gn);
 
-                       } else if (!Arch_ParseArchive(&sacrifice, nodeLst,
-                                                     ctxt)) {
+                       } else if (!Arch_ParseArchive(&sacrifice, gns, ctxt)) {
                                /* Error in nested call. */
                                free(buf);
                                return FALSE;
@@ -357,7 +353,7 @@
                                free(fullname);
 
                                gn->type |= OP_ARCHV;
-                               Lst_Append(nodeLst, gn);
+                               Lst_Append(gns, gn);
                        }
                        Lst_Done(&members);
 
@@ -375,7 +371,7 @@
                         * we place it on the end of the provided list.
                         */
                        gn->type |= OP_ARCHV;
-                       Lst_Append(nodeLst, gn);
+                       Lst_Append(gns, gn);
                }
                if (doSubst)
                        free(memName);
diff -r 59ee110c12d8 -r a8cdd0d66f5c usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Fri Dec 04 14:28:50 2020 +0000
+++ b/usr.bin/make/dir.c        Fri Dec 04 14:39:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.248 2020/12/04 14:28:50 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.249 2020/12/04 14:39:56 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -136,7 +136,7 @@
 #include "job.h"
 
 /*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: dir.c,v 1.248 2020/12/04 14:28:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.249 2020/12/04 14:39:56 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -1667,9 +1667,10 @@
 void
 SearchPath_Print(SearchPath *path)
 {
-       SearchPathNode *node;
-       for (node = path->first; node != NULL; node = node->next) {
-               const CachedDir *dir = node->datum;
+       SearchPathNode *ln;
+
+       for (ln = path->first; ln != NULL; ln = ln->next) {
+               const CachedDir *dir = ln->datum;
                debug_printf("%s ", dir->name);
        }
 }
diff -r 59ee110c12d8 -r a8cdd0d66f5c usr.bin/make/job.c
--- a/usr.bin/make/job.c        Fri Dec 04 14:28:50 2020 +0000
+++ b/usr.bin/make/job.c        Fri Dec 04 14:39:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.334 2020/11/29 09:27:40 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.335 2020/12/04 14:39:56 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.334 2020/11/29 09:27:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.335 2020/12/04 14:39:56 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -919,10 +919,10 @@
 static void
 JobSaveCommands(Job *job)
 {
-    StringListNode *node;
+    StringListNode *ln;
 
-    for (node = job->tailCmds; node != NULL; node = node->next) {
-       const char *cmd = node->datum;
+    for (ln = job->tailCmds; ln != NULL; ln = ln->next) {
+       const char *cmd = ln->datum;
        char *expanded_cmd;
        /* XXX: This Var_Subst is only intended to expand the dynamic
         * variables such as .TARGET, .IMPSRC.  It is not intended to
diff -r 59ee110c12d8 -r a8cdd0d66f5c usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Fri Dec 04 14:28:50 2020 +0000
+++ b/usr.bin/make/lst.c        Fri Dec 04 14:39:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.97 2020/11/29 00:54:43 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.98 2020/12/04 14:39:56 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -34,7 +34,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.97 2020/11/29 00:54:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.98 2020/12/04 14:39:56 rillig Exp $");
 
 static ListNode *
 LstNodeNew(ListNode *prev, ListNode *next, void *datum)
@@ -226,20 +226,20 @@
 void
 Lst_PrependAll(List *dst, List *src)
 {
-       ListNode *node;
+       ListNode *ln;
 
-       for (node = src->last; node != NULL; node = node->prev)
-               Lst_Prepend(dst, node->datum);
+       for (ln = src->last; ln != NULL; ln = ln->prev)
+               Lst_Prepend(dst, ln->datum);
 }
 
 /* Copy the element data from src to the end of dst. */
 void
 Lst_AppendAll(List *dst, List *src)
 {
-       ListNode *node;
+       ListNode *ln;
 
-       for (node = src->first; node != NULL; node = node->next)
-               Lst_Append(dst, node->datum);
+       for (ln = src->first; ln != NULL; ln = ln->next)
+               Lst_Append(dst, ln->datum);
 }
 
 /*
diff -r 59ee110c12d8 -r a8cdd0d66f5c usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Fri Dec 04 14:28:50 2020 +0000
+++ b/usr.bin/make/targ.c       Fri Dec 04 14:39:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.148 2020/11/29 01:05:08 rillig Exp $        */
+/*     $NetBSD: targ.c,v 1.149 2020/12/04 14:39:56 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -119,7 +119,7 @@
 #include "dir.h"
 
 /*     "@(#)targ.c     8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.148 2020/11/29 01:05:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.149 2020/12/04 14:39:56 rillig Exp $");
 
 /*
  * All target nodes that appeared on the left-hand side of one of the
@@ -306,19 +306,23 @@
     return endNode;
 }
 
-/* Return the named nodes, creating them as necessary. */
+/* Add the named nodes to the list, creating them as necessary. */
 void
-Targ_FindList(GNodeList *nodes, StringList *names)
+Targ_FindList(GNodeList *gns, StringList *names)
 {
     StringListNode *ln;
+
     for (ln = names->first; ln != NULL; ln = ln->next) {
        const char *name = ln->datum;
        GNode *gn = Targ_GetNode(name);
-       Lst_Append(nodes, gn);
+       Lst_Append(gns, gn);
     }
 }
 
-/* Return true if should ignore errors when creating gn. */
+/*
+ * Return true if errors from shell commands should be ignored when
+ * creating gn.
+ */
 Boolean
 Targ_Ignore(const GNode *gn)
 {
@@ -356,10 +360,10 @@
 static void
 PrintNodeNames(GNodeList *gnodes)
 {
-    GNodeListNode *node;
+    GNodeListNode *ln;
 
-    for (node = gnodes->first; node != NULL; node = node->next) {
-       GNode *gn = node->datum;
+    for (ln = gnodes->first; ln != NULL; ln = ln->next) {
+       GNode *gn = ln->datum;
        debug_printf(" %s%s", gn->name, gn->cohort_num);
     }
 }



Home | Main Index | Thread Index | Old Index