summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authordsl <dsl@NetBSD.org>2006-11-11 21:23:36 +0000
committerdsl <dsl@NetBSD.org>2006-11-11 21:23:36 +0000
commitd2c6b9d3fe4ce73e5f3f9cd87f78a4e491edc5f5 (patch)
tree3790acbde57c18e3e2cd0b1c101172624cd67c70 /usr.bin/make
parente2455acf6d29cf7284a83bca944b38c3ee3f8e0c (diff)
Return the non-zero value that caused the Lst_ForEach[From] call to
terminate early to the caller.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/lst.h6
-rw-r--r--usr.bin/make/lst.lib/Makefile4
-rw-r--r--usr.bin/make/lst.lib/lstForEach.c10
-rw-r--r--usr.bin/make/lst.lib/lstForEachFrom.c11
4 files changed, 16 insertions, 15 deletions
diff --git a/usr.bin/make/lst.h b/usr.bin/make/lst.h
index 03e02616d2a..5319637cc3d 100644
--- a/usr.bin/make/lst.h
+++ b/usr.bin/make/lst.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.h,v 1.14 2006/10/27 21:37:25 dsl Exp $ */
+/* $NetBSD: lst.h,v 1.15 2006/11/11 21:23:36 dsl Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -167,13 +167,13 @@ LstNode Lst_FindFrom(Lst, LstNode, ClientData,
*/
LstNode Lst_Member(Lst, ClientData);
/* Apply a function to all elements of a lst */
-void Lst_ForEach(Lst, int (*)(ClientData, ClientData), ClientData);
+int Lst_ForEach(Lst, int (*)(ClientData, ClientData), ClientData);
/*
* Apply a function to all elements of a lst starting from a certain point.
* If the list is circular, the application will wrap around to the
* beginning of the list again.
*/
-void Lst_ForEachFrom(Lst, LstNode, int (*)(ClientData, ClientData),
+int Lst_ForEachFrom(Lst, LstNode, int (*)(ClientData, ClientData),
ClientData);
/*
* these functions are for dealing with a list as a table, of sorts.
diff --git a/usr.bin/make/lst.lib/Makefile b/usr.bin/make/lst.lib/Makefile
index 0f8302ab20b..5b33a5062fd 100644
--- a/usr.bin/make/lst.lib/Makefile
+++ b/usr.bin/make/lst.lib/Makefile
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.5 1997/10/24 09:00:49 lukem Exp $
+# $NetBSD: Makefile,v 1.6 2006/11/11 21:23:36 dsl Exp $
OBJ=lstAppend.o lstDupl.o lstInit.o lstOpen.o lstAtEnd.o lstEnQueue.o \
lstInsert.o lstAtFront.o lstIsAtEnd.o lstClose.o lstFind.o lstIsEmpty.o \
lstRemove.o lstConcat.o lstFindFrom.o lstLast.o lstReplace.o lstFirst.o \
lstDatum.o lstForEach.o lstMember.o lstSucc.o lstDeQueue.o \
- lstForEachFrom.o lstDestroy.o lstNext.o
+ lstForEachFrom.o lstDestroy.o lstNext.o lstPrev.o
CPPFLAGS=-I${.CURDIR}/..
all: ${OBJ}
diff --git a/usr.bin/make/lst.lib/lstForEach.c b/usr.bin/make/lst.lib/lstForEach.c
index f81cb34753f..ac4ff4e1936 100644
--- a/usr.bin/make/lst.lib/lstForEach.c
+++ b/usr.bin/make/lst.lib/lstForEach.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lstForEach.c,v 1.11 2004/05/07 00:04:41 ross Exp $ */
+/* $NetBSD: lstForEach.c,v 1.12 2006/11/11 21:23:36 dsl Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lstForEach.c,v 1.11 2004/05/07 00:04:41 ross Exp $";
+static char rcsid[] = "$NetBSD: lstForEach.c,v 1.12 2006/11/11 21:23:36 dsl Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstForEach.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: lstForEach.c,v 1.11 2004/05/07 00:04:41 ross Exp $");
+__RCSID("$NetBSD: lstForEach.c,v 1.12 2006/11/11 21:23:36 dsl Exp $");
#endif
#endif /* not lint */
#endif
@@ -68,9 +68,9 @@ __RCSID("$NetBSD: lstForEach.c,v 1.11 2004/05/07 00:04:41 ross Exp $");
*-----------------------------------------------------------------------
*/
/*VARARGS2*/
-void
+int
Lst_ForEach(Lst l, int (*proc)(ClientData, ClientData), ClientData d)
{
- Lst_ForEachFrom(l, Lst_First(l), proc, d);
+ return Lst_ForEachFrom(l, Lst_First(l), proc, d);
}
diff --git a/usr.bin/make/lst.lib/lstForEachFrom.c b/usr.bin/make/lst.lib/lstForEachFrom.c
index a8fc50e42c8..c9e4c45f858 100644
--- a/usr.bin/make/lst.lib/lstForEachFrom.c
+++ b/usr.bin/make/lst.lib/lstForEachFrom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lstForEachFrom.c,v 1.12 2006/10/27 21:37:25 dsl Exp $ */
+/* $NetBSD: lstForEachFrom.c,v 1.13 2006/11/11 21:23:36 dsl Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -33,14 +33,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lstForEachFrom.c,v 1.12 2006/10/27 21:37:25 dsl Exp $";
+static char rcsid[] = "$NetBSD: lstForEachFrom.c,v 1.13 2006/11/11 21:23:36 dsl Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: lstForEachFrom.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
+__RCSID("$NetBSD: lstForEachFrom.c,v 1.13 2006/11/11 21:23:36 dsl Exp $");
#endif
#endif /* not lint */
#endif
@@ -69,7 +69,7 @@ __RCSID("$NetBSD: lstForEachFrom.c,v 1.12 2006/10/27 21:37:25 dsl Exp $");
*-----------------------------------------------------------------------
*/
/*VARARGS2*/
-void
+int
Lst_ForEachFrom(Lst l, LstNode ln, int (*proc)(ClientData, ClientData),
ClientData d)
{
@@ -80,7 +80,7 @@ Lst_ForEachFrom(Lst l, LstNode ln, int (*proc)(ClientData, ClientData),
int result;
if (!LstValid (list) || LstIsEmpty (list)) {
- return;
+ return 0;
}
do {
@@ -120,5 +120,6 @@ Lst_ForEachFrom(Lst l, LstNode ln, int (*proc)(ClientData, ClientData),
tln = next;
} while (!result && !LstIsEmpty(list) && !done);
+ return result;
}