Module Name:    src
Committed By:   rillig
Date:           Mon Oct 19 19:34:18 UTC 2020

Modified Files:
        src/usr.bin/make: targ.c

Log Message:
make(1): fix variable names in Targ_Propagate

List nodes are called ln, not pn or cn.

While here, extract a common subexpression to save a few instructions.
The compiler cannot know that gn->type will not change during the whole
loop.  For this, it would have to know that a GNode cannot have itself
as a cohort, and this is not expressed anywhere in the code.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 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/targ.c
diff -u src/usr.bin/make/targ.c:1.116 src/usr.bin/make/targ.c:1.117
--- src/usr.bin/make/targ.c:1.116	Sun Oct 18 13:02:10 2020
+++ src/usr.bin/make/targ.c	Mon Oct 19 19:34:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: targ.c,v 1.116 2020/10/18 13:02:10 rillig Exp $	*/
+/*	$NetBSD: targ.c,v 1.117 2020/10/19 19:34:18 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include "dir.h"
 
 /*	"@(#)targ.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: targ.c,v 1.116 2020/10/18 13:02:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.117 2020/10/19 19:34:18 rillig Exp $");
 
 static GNodeList *allTargets;	/* the list of all targets found so far */
 #ifdef CLEANUP
@@ -554,18 +554,19 @@ Targ_PrintGraph(int pass)
 void
 Targ_Propagate(void)
 {
-    GNodeListNode *pn, *cn;
+    GNodeListNode *ln, *cln;
 
-    for (pn = allTargets->first; pn != NULL; pn = pn->next) {
-	GNode *pgn = pn->datum;
+    for (ln = allTargets->first; ln != NULL; ln = ln->next) {
+	GNode *gn = ln->datum;
+	GNodeType type = gn->type;
 
-	if (!(pgn->type & OP_DOUBLEDEP))
+	if (!(type & OP_DOUBLEDEP))
 	    continue;
 
-	for (cn = pgn->cohorts->first; cn != NULL; cn = cn->next) {
-	    GNode *cgn = cn->datum;
+	for (cln = gn->cohorts->first; cln != NULL; cln = cln->next) {
+	    GNode *cohort = cln->datum;
 
-	    cgn->type |= pgn->type & ~OP_OPMASK;
+	    cohort->type |= type & ~OP_OPMASK;
 	}
     }
 }

Reply via email to