summaryrefslogtreecommitdiff
path: root/usr.bin/make/lst.lib/lstForEachFrom.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/make/lst.lib/lstForEachFrom.c')
-rw-r--r--usr.bin/make/lst.lib/lstForEachFrom.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/usr.bin/make/lst.lib/lstForEachFrom.c b/usr.bin/make/lst.lib/lstForEachFrom.c
index 7c9e51e749f0..a5efc640d299 100644
--- a/usr.bin/make/lst.lib/lstForEachFrom.c
+++ b/usr.bin/make/lst.lib/lstForEachFrom.c
@@ -1,3 +1,5 @@
+/* $NetBSD: lstForEachFrom.c,v 1.4 1995/06/14 15:21:16 christos Exp $ */
+
/*
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)lstForEachFrom.c 8.2 (Berkeley) 4/28/95";
+#if 0
+static char sccsid[] = "@(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/93";
+#else
+static char rcsid[] = "$NetBSD: lstForEachFrom.c,v 1.4 1995/06/14 15:21:16 christos Exp $";
+#endif
#endif /* not lint */
/*-
@@ -51,7 +57,7 @@ static char sccsid[] = "@(#)lstForEachFrom.c 8.2 (Berkeley) 4/28/95";
* Lst_ForEachFrom --
* Apply the given function to each element of the given list. The
* function should return 0 if traversal should continue and non-
- * zero if it should abort.
+ * zero if it should abort.
*
* Results:
* None.
@@ -66,7 +72,7 @@ void
Lst_ForEachFrom (l, ln, proc, d)
Lst l;
LstNode ln;
- register int (*proc)();
+ register int (*proc) __P((ClientData, ClientData));
register ClientData d;
{
register ListNode tln = (ListNode)ln;
@@ -74,19 +80,19 @@ Lst_ForEachFrom (l, ln, proc, d)
register ListNode next;
Boolean done;
int result;
-
+
if (!LstValid (list) || LstIsEmpty (list)) {
return;
}
-
+
do {
/*
* Take care of having the current element deleted out from under
* us.
*/
-
+
next = tln->nextPtr;
-
+
(void) tln->useCount++;
result = (*proc) (tln->datum, d);
(void) tln->useCount--;
@@ -99,7 +105,7 @@ Lst_ForEachFrom (l, ln, proc, d)
*/
done = (next == tln->nextPtr &&
(next == NilListNode || next == list->firstPtr));
-
+
next = tln->nextPtr;
if (tln->flags & LN_DELETED) {
@@ -107,5 +113,6 @@ Lst_ForEachFrom (l, ln, proc, d)
}
tln = next;
} while (!result && !LstIsEmpty(list) && !done);
-
+
}
+