Module Name: src
Committed By: rillig
Date: Sun Oct 18 14:58:46 UTC 2020
Modified Files:
src/usr.bin/make: make.c
Log Message:
make(1): replace Lst_Open with simple iteration in Make_HandleUse
To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/usr.bin/make/make.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/make.c
diff -u src/usr.bin/make/make.c:1.160 src/usr.bin/make/make.c:1.161
--- src/usr.bin/make/make.c:1.160 Sun Oct 18 13:02:10 2020
+++ src/usr.bin/make/make.c Sun Oct 18 14:58:45 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.c,v 1.160 2020/10/18 13:02:10 rillig Exp $ */
+/* $NetBSD: make.c,v 1.161 2020/10/18 14:58:45 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
#include "job.h"
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
-MAKE_RCSID("$NetBSD: make.c,v 1.160 2020/10/18 13:02:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.161 2020/10/18 14:58:45 rillig Exp $");
/* Sequence # to detect recursion. */
static unsigned int checked = 1;
@@ -386,8 +386,9 @@ MakeFindChild(void *gnp, void *pgnp)
* has commands.
*
* Input:
- * cgn The .USE node
- * pgn The target of the .USE node
+ * cgn The source node, which is either a .USE/.USEBEFORE
+ * node or a transformation node (OP_TRANSFORM).
+ * pgn The target node
*/
void
Make_HandleUse(GNode *cgn, GNode *pgn)
@@ -411,9 +412,8 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
}
}
- Lst_Open(cgn->children);
- while ((ln = Lst_Next(cgn->children)) != NULL) {
- GNode *gn = LstNode_Datum(ln);
+ for (ln = cgn->children->first; ln != NULL; ln = ln->next) {
+ GNode *gn = ln->datum;
/*
* Expand variables in the .USE node's name
@@ -439,7 +439,6 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
Lst_Append(gn->parents, pgn);
pgn->unmade++;
}
- Lst_Close(cgn->children);
pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_USEBEFORE|OP_TRANSFORM);
}