summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/make.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-12-08 16:22:01 +0000
committerharti <harti@FreeBSD.org>2004-12-08 16:22:01 +0000
commitbcb1f1f6f57e4630d36245b7c5fb2ce234218041 (patch)
tree033640eae93833ae9810ed9247ac98509312f27b /usr.bin/make/make.c
parenta3e11dfa9b1fa344ae2ae1129eaf1c441f32d88e (diff)
downloadFreeBSD-src-bcb1f1f6f57e4630d36245b7c5fb2ce234218041.zip
FreeBSD-src-bcb1f1f6f57e4630d36245b7c5fb2ce234218041.tar.gz
Get rid of the sequential access feature of the lists. This was used
only in a couple of places and all of them except for one were easily converted to use Lst_First/Lst_Succ. The one place is compatibility mode in job.c where the it was used to advance to the next command on each invocation of JobStart. For this case add a pointer to the node to hold the currently executed command.
Diffstat (limited to 'usr.bin/make/make.c')
-rw-r--r--usr.bin/make/make.c84
1 files changed, 38 insertions, 46 deletions
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index 93411f8..f064348 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -310,17 +310,14 @@ Make_HandleUse(GNode *cgn, GNode *pgn)
Lst_Concat(pgn->commands, cgn->commands, LST_CONCNEW);
}
- if (Lst_Open(cgn->children) == SUCCESS) {
- while ((ln = Lst_Next(cgn->children)) != NULL) {
- gn = Lst_Datum(ln);
-
- if (Lst_Member(pgn->children, gn) == NULL) {
- Lst_AtEnd(pgn->children, gn);
- Lst_AtEnd(gn->parents, pgn);
- pgn->unmade += 1;
- }
+ for (ln = Lst_First(cgn->children); ln != NULL; ln = Lst_Succ(ln)) {
+ gn = Lst_Datum(ln);
+
+ if (Lst_Member(pgn->children, gn) == NULL) {
+ Lst_AtEnd(pgn->children, gn);
+ Lst_AtEnd(gn->parents, pgn);
+ pgn->unmade += 1;
}
- Lst_Close(cgn->children);
}
pgn->type |= cgn->type & ~(OP_OPMASK | OP_USE | OP_TRANSFORM);
@@ -378,6 +375,8 @@ Make_Update(GNode *cgn)
char *cname; /* the child's name */
LstNode *ln; /* Element in parents and iParents lists */
char *p1;
+ char *ptr;
+ char *cpref;
cname = Var_Value(TARGET, cgn, &p1);
free(p1);
@@ -447,35 +446,33 @@ Make_Update(GNode *cgn)
#endif
}
- if (Lst_Open(cgn->parents) == SUCCESS) {
- while ((ln = Lst_Next(cgn->parents)) != NULL) {
- pgn = Lst_Datum(ln);
- if (pgn->make) {
- pgn->unmade -= 1;
-
- if (!(cgn->type & (OP_EXEC | OP_USE))) {
- if (cgn->made == MADE) {
- pgn->childMade = TRUE;
- if (pgn->cmtime < cgn->mtime) {
- pgn->cmtime = cgn->mtime;
- }
- } else {
- Make_TimeStamp(pgn, cgn);
+ for (ln = Lst_First(cgn->parents); ln != NULL; ln = Lst_Succ(ln)) {
+ pgn = Lst_Datum(ln);
+ if (pgn->make) {
+ pgn->unmade -= 1;
+
+ if (!(cgn->type & (OP_EXEC | OP_USE))) {
+ if (cgn->made == MADE) {
+ pgn->childMade = TRUE;
+ if (pgn->cmtime < cgn->mtime) {
+ pgn->cmtime = cgn->mtime;
}
- }
- if (pgn->unmade == 0) {
- /*
- * Queue the node up -- any unmade predecessors will
- * be dealt with in MakeStartJobs.
- */
- Lst_EnQueue(toBeMade, pgn);
- } else if (pgn->unmade < 0) {
- Error("Graph cycles through %s", pgn->name);
+ } else {
+ Make_TimeStamp(pgn, cgn);
}
}
+ if (pgn->unmade == 0) {
+ /*
+ * Queue the node up -- any unmade predecessors will
+ * be dealt with in MakeStartJobs.
+ */
+ Lst_EnQueue(toBeMade, pgn);
+ } else if (pgn->unmade < 0) {
+ Error("Graph cycles through %s", pgn->name);
+ }
}
- Lst_Close(cgn->parents);
}
+
/*
* Deal with successor nodes. If any is marked for making and has an unmade
* count of 0, has not been made and isn't in the examination queue,
@@ -496,20 +493,15 @@ Make_Update(GNode *cgn)
* Set the .PREFIX and .IMPSRC variables for all the implied parents
* of this node.
*/
- if (Lst_Open(cgn->iParents) == SUCCESS) {
- char *ptr;
- char *cpref = Var_Value(PREFIX, cgn, &ptr);
-
- while ((ln = Lst_Next(cgn->iParents)) != NULL) {
- pgn = Lst_Datum (ln);
- if (pgn->make) {
- Var_Set(IMPSRC, cname, pgn);
- Var_Set(PREFIX, cpref, pgn);
- }
+ cpref = Var_Value(PREFIX, cgn, &ptr);
+ for (ln = Lst_First(cgn->iParents); ln != NULL; ln = Lst_Succ(ln)) {
+ pgn = Lst_Datum (ln);
+ if (pgn->make) {
+ Var_Set(IMPSRC, cname, pgn);
+ Var_Set(PREFIX, cpref, pgn);
}
- free(ptr);
- Lst_Close(cgn->iParents);
}
+ free(ptr);
}
/*-
OpenPOWER on IntegriCloud