Module Name:    src
Committed By:   rillig
Date:           Fri Dec  4 14:39:56 UTC 2020

Modified Files:
        src/usr.bin/make: arch.c dir.c job.c lst.c targ.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/usr.bin/make/arch.c
cvs rdiff -u -r1.248 -r1.249 src/usr.bin/make/dir.c
cvs rdiff -u -r1.334 -r1.335 src/usr.bin/make/job.c
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/make/lst.c
cvs rdiff -u -r1.148 -r1.149 src/usr.bin/make/targ.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/arch.c
diff -u src/usr.bin/make/arch.c:1.182 src/usr.bin/make/arch.c:1.183
--- src/usr.bin/make/arch.c:1.182	Sun Nov 29 01:40:26 2020
+++ src/usr.bin/make/arch.c	Fri Dec  4 14:39:56 2020
@@ -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 @@ ArchFree(void *ap)
 
 /*
  * 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 @@ Arch_ParseArchive(char **pp, GNodeList *
 			/*
 			 * 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 @@ Arch_ParseArchive(char **pp, GNodeList *
 				 */
 				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 @@ Arch_ParseArchive(char **pp, GNodeList *
 				free(fullname);
 
 				gn->type |= OP_ARCHV;
-				Lst_Append(nodeLst, gn);
+				Lst_Append(gns, gn);
 			}
 			Lst_Done(&members);
 
@@ -375,7 +371,7 @@ Arch_ParseArchive(char **pp, GNodeList *
 			 * 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);

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.248 src/usr.bin/make/dir.c:1.249
--- src/usr.bin/make/dir.c:1.248	Fri Dec  4 14:28:50 2020
+++ src/usr.bin/make/dir.c	Fri Dec  4 14:39:56 2020
@@ -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 @@ Dir_PrintDirectories(void)
 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);
 	}
 }

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.334 src/usr.bin/make/job.c:1.335
--- src/usr.bin/make/job.c:1.334	Sun Nov 29 09:27:40 2020
+++ src/usr.bin/make/job.c	Fri Dec  4 14:39:56 2020
@@ -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 @@ JobPrintCommands(Job *job)
 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

Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.97 src/usr.bin/make/lst.c:1.98
--- src/usr.bin/make/lst.c:1.97	Sun Nov 29 00:54:43 2020
+++ src/usr.bin/make/lst.c	Fri Dec  4 14:39:56 2020
@@ -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 @@ Lst_MoveAll(List *dst, List *src)
 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);
 }
 
 /*

Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.148 src/usr.bin/make/targ.c:1.149
--- src/usr.bin/make/targ.c:1.148	Sun Nov 29 01:05:08 2020
+++ src/usr.bin/make/targ.c	Fri Dec  4 14:39:56 2020
@@ -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 @@ GNode *Targ_GetEndNode(void)
     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 @@ Targ_SetMain(GNode *gn)
 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);
     }
 }

Reply via email to