diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2000-11-22 17:22:29 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2000-11-22 17:22:29 +0000 |
commit | fa32d17335838c283364ebd6a1d4901b228201ab (patch) | |
tree | 718683fde6731f2283936821964da36b53755059 /usr.bin | |
parent | e5bcb1bf2da12f398174d6ac5028e3cfb819a941 (diff) |
Don't use light-weight Lst_ForEach when the list is going away from under
us. Need to cache the `next' pointer instead.
Do this manually, as adding a new function for one place in make where it's
needed is a bit icky, especially since suff.c's code might get cleaned up
at some point.
Bug reported by Niels.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/suff.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index c1fc002de29..8cd736beb2e 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: suff.c,v 1.38 2000/09/14 13:46:45 espie Exp $ */ +/* $OpenBSD: suff.c,v 1.39 2000/11/22 17:22:28 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -101,7 +101,7 @@ static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94"; #else UNUSED -static char rcsid[] = "$OpenBSD: suff.c,v 1.38 2000/09/14 13:46:45 espie Exp $"; +static char rcsid[] = "$OpenBSD: suff.c,v 1.39 2000/11/22 17:22:28 espie Exp $"; #endif #endif /* not lint */ @@ -1460,6 +1460,7 @@ SuffApplyTransform(tGn, sGn, t, s) Suff *s; /* Source suffix */ { LstNode ln; /* General node */ + LstNode np; /* Next node for loop */ char *tname; /* Name of transformation rule */ GNode *gn; /* Node for same */ @@ -1529,8 +1530,10 @@ SuffApplyTransform(tGn, sGn, t, s) /* * Deal with wildcards and variables in any acquired sources */ - ln = Lst_Succ(ln); - Lst_ForEachFrom(ln, SuffExpandChildren, tGn); + for (ln = Lst_Succ(ln); ln != NULL; ln = np) { + np = Lst_Adv(ln); + SuffExpandChildren(Lst_Datum(ln), tGn); + } /* * Keep track of another parent to which this beast is transformed so @@ -1691,6 +1694,7 @@ SuffFindNormalDeps(gn, slst) char *eoname; /* End of name */ char *sopref; /* Start of prefix */ LstNode ln; /* Next suffix node to check */ + LstNode np; LIST srcs; /* List of sources at which to look */ LIST targs; /* List of targets to which things can be * transformed. They all have the same file, @@ -1849,7 +1853,10 @@ SuffFindNormalDeps(gn, slst) * Now we've got the important local variables set, expand any sources * that still contain variables or wildcards in their names. */ - Lst_ForEach(&gn->children, SuffExpandChildren, gn); + for (ln = Lst_First(&gn->children); ln != NULL; ln = np) { + np = Lst_Adv(ln); + SuffExpandChildren(Lst_Datum(ln), gn); + } if (targ == NULL) { if (DEBUG(SUFF)) { |