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): fix variable names in Targ_Propagate



details:   https://anonhg.NetBSD.org/src/rev/320a0e2678c0
branches:  trunk
changeset: 956047:320a0e2678c0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 19 19:34:18 2020 +0000

description:
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.

diffstat:

 usr.bin/make/targ.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (45 lines):

diff -r bf4a8a9215d7 -r 320a0e2678c0 usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Mon Oct 19 19:33:01 2020 +0000
+++ b/usr.bin/make/targ.c       Mon Oct 19 19:34:18 2020 +0000
@@ -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 @@
 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;
        }
     }
 }



Home | Main Index | Thread Index | Old Index