summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/lst.lib
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2001-05-03 13:40:59 +0000
committerespie <espie@openbsd.org>2001-05-03 13:40:59 +0000
commit04ed836e6d5ae76799154a2aa175f9935e7e18a6 (patch)
treedc05061c51e5fa0a5086e2d01d3570791cb2ba15 /usr.bin/make/lst.lib
parentold file (diff)
downloadwireguard-openbsd-04ed836e6d5ae76799154a2aa175f9935e7e18a6.tar.xz
wireguard-openbsd-04ed836e6d5ae76799154a2aa175f9935e7e18a6.zip
Synch with my current work.
Numerous changes: - generate can build several tables - style cleanup - statistics code - use variable names throughout (struct Name) - recursive variables everywhere - faster parser (pass buffer along instead of allocating multiple copies) - correct parser. Handles comments everywhere, and ; correctly - more string intervals - simplified dir.c, less recursion. - extended for loops - sinclude() - finished removing extra junk from Lst_* - handles ${@D} and friends in a simpler way - cleaned up and modular VarModifiers handling. - recognizes some gnu Makefile usages and errors out about them. Additionally, some extra functionality is defined by FEATURES. The set of functionalities is currently hardcoded to OpenBSD defaults, but this may include support for some NetBSD extensions, like ODE modifiers. Backed by miod@ and millert@, who finally got sick of my endless patches...
Diffstat (limited to 'usr.bin/make/lst.lib')
-rw-r--r--usr.bin/make/lst.lib/Makefile12
-rw-r--r--usr.bin/make/lst.lib/lstAddNew.c55
-rw-r--r--usr.bin/make/lst.lib/lstAppend.c42
-rw-r--r--usr.bin/make/lst.lib/lstAtEnd.c72
-rw-r--r--usr.bin/make/lst.lib/lstAtFront.c73
-rw-r--r--usr.bin/make/lst.lib/lstClose.c81
-rw-r--r--usr.bin/make/lst.lib/lstConcat.c68
-rw-r--r--usr.bin/make/lst.lib/lstConcatDestroy.c40
-rw-r--r--usr.bin/make/lst.lib/lstDeQueue.c26
-rw-r--r--usr.bin/make/lst.lib/lstDestroy.c11
-rw-r--r--usr.bin/make/lst.lib/lstDupl.c21
-rw-r--r--usr.bin/make/lst.lib/lstEnQueue.c74
-rw-r--r--usr.bin/make/lst.lib/lstFindFrom.c32
-rw-r--r--usr.bin/make/lst.lib/lstForEachFrom.c31
-rw-r--r--usr.bin/make/lst.lib/lstInit.c12
-rw-r--r--usr.bin/make/lst.lib/lstInsert.c47
-rw-r--r--usr.bin/make/lst.lib/lstInt.h25
-rw-r--r--usr.bin/make/lst.lib/lstIsAtEnd.c82
-rw-r--r--usr.bin/make/lst.lib/lstIsEmpty.c68
-rw-r--r--usr.bin/make/lst.lib/lstMember.c13
-rw-r--r--usr.bin/make/lst.lib/lstNext.c118
-rw-r--r--usr.bin/make/lst.lib/lstOpen.c81
-rw-r--r--usr.bin/make/lst.lib/lstRemove.c57
-rw-r--r--usr.bin/make/lst.lib/lstReplace.c18
-rw-r--r--usr.bin/make/lst.lib/lstSucc.c12
25 files changed, 274 insertions, 897 deletions
diff --git a/usr.bin/make/lst.lib/Makefile b/usr.bin/make/lst.lib/Makefile
index e02ddf6c560..16975809789 100644
--- a/usr.bin/make/lst.lib/Makefile
+++ b/usr.bin/make/lst.lib/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.9 2000/06/23 16:15:50 espie Exp $
+# $OpenPackages$
+# $OpenBSD: Makefile,v 1.10 2001/05/03 13:41:16 espie Exp $
# $NetBSD: Makefile,v 1.4 1996/11/06 17:59:31 christos Exp $
-OBJ=lstAppend.o lstDupl.o lstInit.o lstOpen.o lstAtEnd.o lstEnQueue.o \
- lstInsert.o lstAtFront.o lstIsAtEnd.o lstClose.o lstIsEmpty.o \
- lstRemove.o lstConcat.o lstConcatDestroy.o lstFindFrom.o lstReplace.o \
- lstMember.o lstSucc.o lstDeQueue.o lstForEachFrom.o \
- lstDestroy.o lstNext.o
+OBJ=lstAppend.o lstDupl.o lstInit.o lstEnQueue.o lstInsert.o \
+ lstRemove.o lstConcat.o lstFindFrom.o lstLast.o lstReplace.o lstFirst.o \
+ lstMember.o lstSucc.o lstDeQueue.o \
+ lstForEachFrom.o lstDestroy.o lstAddNew.o lstConcatDestroy.o
CFLAGS+=-I..
all: ${OBJ}
diff --git a/usr.bin/make/lst.lib/lstAddNew.c b/usr.bin/make/lst.lib/lstAddNew.c
new file mode 100644
index 00000000000..2c74119b371
--- /dev/null
+++ b/usr.bin/make/lst.lib/lstAddNew.c
@@ -0,0 +1,55 @@
+/* $OpenPackages$ */
+/* $OpenBSD: lstAddNew.c,v 1.1 2001/05/03 13:41:16 espie Exp $ */
+/* ex:ts=8 sw=4:
+ */
+
+/*
+ * Copyright (c) 1999 Marc Espie.
+ *
+ * Code written for the OpenBSD project.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
+ * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "lstInt.h"
+
+#ifndef lint
+UNUSED
+static char rcsid[] = "$OpenBSD: lstAddNew.c,v 1.1 2001/05/03 13:41:16 espie Exp $";
+#endif /* not lint */
+
+/* Add datum to the end of a list only if it wasn't there already.
+ * Returns FAILURE if datum was already there.
+ */
+ReturnStatus
+Lst_AddNew(l, d)
+ Lst l;
+ void *d;
+{
+ if (Lst_Member(l, d) != NULL)
+ return FAILURE;
+ else {
+ Lst_AtEnd(l, d);
+ return SUCCESS;
+ }
+}
+
diff --git a/usr.bin/make/lst.lib/lstAppend.c b/usr.bin/make/lst.lib/lstAppend.c
index f0ecb75dc19..86316326bc3 100644
--- a/usr.bin/make/lst.lib/lstAppend.c
+++ b/usr.bin/make/lst.lib/lstAppend.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstAppend.c,v 1.11 2000/09/14 13:32:08 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstAppend.c,v 1.12 2001/05/03 13:41:17 espie Exp $ */
/* $NetBSD: lstAppend.c,v 1.5 1996/11/06 17:59:31 christos Exp $ */
/*
@@ -43,24 +44,21 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
-static char sccsid[] = "@(#)lstAppend.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)lstAppend.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstAppend.c,v 1.11 2000/09/14 13:32:08 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstAppend.c,v 1.12 2001/05/03 13:41:17 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Append --
* Create a new node and add it to the given list after the given node.
*
- * Results:
- * SUCCESS if all went well.
- *
* Side Effects:
* A new ListNode is created and linked in to the List. The lastPtr
* field of the List will be altered if ln is the last node in the
@@ -71,22 +69,20 @@ static char rcsid[] = "$OpenBSD: lstAppend.c,v 1.11 2000/09/14 13:32:08 espie Ex
*/
void
Lst_Append(l, ln, d)
- Lst l; /* affected list */
+ Lst l; /* affected list */
LstNode ln; /* node after which to append the datum */
- void *d; /* said datum */
+ void *d; /* said datum */
{
LstNode nLNode;
- if (ln == NULL && LstIsEmpty(l))
- goto ok;
+ if (ln == NULL && !Lst_IsEmpty(l))
+ return;
- if (LstIsEmpty(l) || ! LstNodeValid(ln, l))
+ if (ln != NULL && Lst_IsEmpty(l))
return;
- ok:
PAlloc(nLNode, LstNode);
nLNode->datum = d;
- nLNode->useCount = nLNode->flags = 0;
if (ln == NULL) {
nLNode->nextPtr = nLNode->prevPtr = NULL;
@@ -104,3 +100,21 @@ Lst_Append(l, ln, d)
}
}
+void
+Lst_AtEnd(l, d)
+ Lst l;
+ void *d;
+{
+ LstNode ln;
+
+ PAlloc(ln, LstNode);
+ ln->datum = d;
+
+ ln->prevPtr = l->lastPtr;
+ ln->nextPtr = NULL;
+ if (l->lastPtr == NULL)
+ l->firstPtr = ln;
+ else
+ l->lastPtr->nextPtr = ln;
+ l->lastPtr = ln;
+}
diff --git a/usr.bin/make/lst.lib/lstAtEnd.c b/usr.bin/make/lst.lib/lstAtEnd.c
deleted file mode 100644
index 45b39a49a7c..00000000000
--- a/usr.bin/make/lst.lib/lstAtEnd.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $OpenBSD: lstAtEnd.c,v 1.7 2000/09/14 13:32:08 espie Exp $ */
-/* $NetBSD: lstAtEnd.c,v 1.5 1996/11/06 17:59:32 christos Exp $ */
-
-/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*-
- * LstAtEnd.c --
- * Add a node at the end of the list
- */
-
-#include "lstInt.h"
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lstAtEnd.c 8.1 (Berkeley) 6/6/93";
-#else
-UNUSED
-static char rcsid[] = "$OpenBSD: lstAtEnd.c,v 1.7 2000/09/14 13:32:08 espie Exp $";
-#endif
-#endif /* not lint */
-
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_AtEnd --
- * Add a node to the end of the given list
- *
- * Side Effects:
- * A new ListNode is created and added to the list.
- *
- *-----------------------------------------------------------------------
- */
-void
-Lst_AtEnd(l, d)
- Lst l; /* List to which to add the datum */
- void *d; /* Datum to add */
-{
- Lst_Append(l, Lst_Last(l), d);
-}
diff --git a/usr.bin/make/lst.lib/lstAtFront.c b/usr.bin/make/lst.lib/lstAtFront.c
deleted file mode 100644
index 070bea0e9ff..00000000000
--- a/usr.bin/make/lst.lib/lstAtFront.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: lstAtFront.c,v 1.7 2000/09/14 13:32:08 espie Exp $ */
-/* $NetBSD: lstAtFront.c,v 1.5 1996/11/06 17:59:33 christos Exp $ */
-
-/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*-
- * LstAtFront.c --
- * Add a node at the front of the list
- */
-
-#include "lstInt.h"
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lstAtFront.c 8.1 (Berkeley) 6/6/93";
-#else
-UNUSED
-static char rcsid[] = "$OpenBSD: lstAtFront.c,v 1.7 2000/09/14 13:32:08 espie Exp $";
-#endif
-#endif /* not lint */
-
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_AtFront --
- * Place a piece of data at the front of a list
- *
- * Side Effects:
- * A new ListNode is created and stuck at the front of the list.
- * hence, firstPtr (and possible lastPtr) in the list are altered.
- *
- *-----------------------------------------------------------------------
- */
-void
-Lst_AtFront(l, d)
- Lst l;
- void *d;
-{
- Lst_Insert(l, Lst_First(l), d);
-}
diff --git a/usr.bin/make/lst.lib/lstClose.c b/usr.bin/make/lst.lib/lstClose.c
deleted file mode 100644
index 05fc360bb77..00000000000
--- a/usr.bin/make/lst.lib/lstClose.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: lstClose.c,v 1.7 2000/09/14 13:32:08 espie Exp $ */
-/* $NetBSD: lstClose.c,v 1.5 1996/11/06 17:59:34 christos Exp $ */
-
-/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*-
- * LstClose.c --
- * Close a list for sequential access.
- * The sequential functions access the list in a slightly different way.
- * CurPtr points to their idea of the current node in the list and they
- * access the list based on it. Because the list is circular, Lst_Next
- * and Lst_Prev will go around the list forever. Lst_IsAtEnd must be
- * used to determine when to stop.
- */
-
-#include "lstInt.h"
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lstClose.c 8.1 (Berkeley) 6/6/93";
-#else
-UNUSED
-static char rcsid[] = "$OpenBSD: lstClose.c,v 1.7 2000/09/14 13:32:08 espie Exp $";
-#endif
-#endif /* not lint */
-
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_Close --
- * Close a list which was opened for sequential access.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * The list is closed.
- *
- *-----------------------------------------------------------------------
- */
-void
-Lst_Close(l)
- Lst l; /* The list to close */
-{
- l->isOpen = FALSE;
- l->atEnd = Unknown;
-}
-
diff --git a/usr.bin/make/lst.lib/lstConcat.c b/usr.bin/make/lst.lib/lstConcat.c
index 15618b47f81..c56ff3d0f2d 100644
--- a/usr.bin/make/lst.lib/lstConcat.c
+++ b/usr.bin/make/lst.lib/lstConcat.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstConcat.c,v 1.11 2000/09/14 13:32:08 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstConcat.c,v 1.12 2001/05/03 13:41:19 espie Exp $ */
/* $NetBSD: lstConcat.c,v 1.6 1996/11/06 17:59:34 christos Exp $ */
/*
@@ -39,60 +40,53 @@
/*-
* listConcat.c --
- * Function to concatentate two lists.
+ * Function to copy a list and append it to another.
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
-static char sccsid[] = "@(#)lstConcat.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)lstConcat.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstConcat.c,v 1.11 2000/09/14 13:32:08 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstConcat.c,v 1.12 2001/05/03 13:41:19 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Concat --
* Concatenate two lists. New elements are created to hold the data
- * elements, but the elements themselves are not copied.
- * If the elements should be duplicated to avoid confusion with another
- * list, the Lst_Duplicate function should be called first.
- *
- * Results:
- * SUCCESS if all went well. FAILURE otherwise.
+ * elements but the elements themselves are not copied.
+ * If the elements themselves should be duplicated to avoid
+ * confusion with another list, the Lst_Duplicate function
+ * should be called first.
*
* Side Effects:
- * New elements are created and appended to the first list.
+ * New elements are created and appended the the first list.
*-----------------------------------------------------------------------
*/
void
Lst_Concat(l1, l2)
- Lst l1; /* The list to which l2 is to be appended */
- Lst l2; /* The list to append to l1 */
+ Lst l1; /* The list to which l2 is to be appended */
+ Lst l2; /* The list to append to l1 */
{
- LstNode ln; /* original LstNode */
- LstNode nln; /* new LstNode */
- LstNode last; /* the last element in the list. Keeps
+ LstNode ln; /* original LstNode */
+ LstNode nln; /* new LstNode */
+ LstNode last; /* the last element in the list. Keeps
* bookkeeping until the end */
-
if (l2->firstPtr != NULL) {
- /*
- * We set the nextPtr of the last element of list 2 to be NULL to make
- * the loop less difficult. The loop simply goes through the entire
- * second list creating new LstNodes and filling in the nextPtr, and
- * prevPtr to fit into l1 and its datum field from the
- * datum field of the corresponding element in l2. The 'last' node
- * follows the last of the new nodes along until the entire l2 has
- * been appended. Only then does the bookkeeping catch up with the
- * changes. During the first iteration of the loop, if 'last' is NULL,
- * the first list must have been empty so the newly-created node is
- * made the first node of the list.
- */
- l2->lastPtr->nextPtr = NULL;
- for (last = l1->lastPtr, ln = l2->firstPtr; ln != NULL;
+ /* The loop simply goes through the entire second list creating new
+ * LstNodes and filling in the nextPtr, and prevPtr to fit into l1
+ * and its datum field from the datum field of the corresponding
+ * element in l2. The 'last' node follows the last of the new nodes
+ * along until the entire l2 has been appended. Only then does the
+ * bookkeeping catch up with the changes. During the first iteration
+ * of the loop, if 'last' is NULL, the first list must have been empty
+ * so the newly-created node is made the first node of the list. */
+ for (last = l1->lastPtr, ln = l2->firstPtr;
+ ln != NULL;
ln = ln->nextPtr) {
PAlloc(nln, LstNode);
nln->datum = ln->datum;
@@ -101,19 +95,13 @@ Lst_Concat(l1, l2)
else
l1->firstPtr = nln;
nln->prevPtr = last;
- nln->flags = nln->useCount = 0;
last = nln;
}
- /*
- * Finish bookkeeping. The last new element becomes the last element
- * of list one.
- */
+ /* Finish bookkeeping. The last new element becomes the last element
+ * of l1. */
l1->lastPtr = last;
-
last->nextPtr = NULL;
-
- l2->lastPtr->nextPtr = l2->firstPtr;
}
}
diff --git a/usr.bin/make/lst.lib/lstConcatDestroy.c b/usr.bin/make/lst.lib/lstConcatDestroy.c
index b45df54a8c3..83f95d278f4 100644
--- a/usr.bin/make/lst.lib/lstConcatDestroy.c
+++ b/usr.bin/make/lst.lib/lstConcatDestroy.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstConcatDestroy.c,v 1.2 2000/09/14 13:32:08 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstConcatDestroy.c,v 1.3 2001/05/03 13:41:19 espie Exp $ */
/* $NetBSD: lstConcat.c,v 1.6 1996/11/06 17:59:34 christos Exp $ */
/*
@@ -38,52 +39,40 @@
*/
/*-
- * listConcatDestroy.c --
+ * listConcat.c --
* Function to concatentate two lists.
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
-static char sccsid[] = "@(#)lstConcat.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)lstConcat.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstConcatDestroy.c,v 1.2 2000/09/14 13:32:08 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstConcatDestroy.c,v 1.3 2001/05/03 13:41:19 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_ConcatDestroy --
- * Concatenate two lists. The elements of the second list are
- * destructively added to the first list. If the elements should
- * be duplicated to avoid confusion with another list, the
+ * Concatenate two lists. The elements of the second list are
+ * destructively added to the first list. If the elements should
+ * be duplicated to avoid confusion with another list, the
* Lst_Duplicate function should be called first.
*
- * Results:
- * SUCCESS if all went well. FAILURE otherwise.
- *
* Side Effects:
- * The second list is destroyed
+ * The second list is destroyed.
*-----------------------------------------------------------------------
*/
void
Lst_ConcatDestroy(l1, l2)
- Lst l1; /* The list to which l2 is to be appended */
- Lst l2; /* The list to append to l1 */
+ Lst l1; /* The list to which l2 is to be appended */
+ Lst l2; /* The list to append to l1 */
{
if (l2->firstPtr != NULL) {
/*
- * We set the nextPtr of the
- * last element of list two to be NULL to make the loop easier and
- * so we don't need an extra case should the first list turn
- * out to be non-circular -- the final element will already point
- * to NULL space and the first element will be untouched if it
- * existed before and will also point to NULL space if it didn't.
- */
- l2->lastPtr->nextPtr = NULL;
- /*
* So long as the second list isn't empty, we just link the
* first element of the second list to the last element of the
* first list. If the first list isn't empty, we then link the
@@ -92,11 +81,10 @@ Lst_ConcatDestroy(l1, l2)
* the last element of the first list.
*/
l2->firstPtr->prevPtr = l1->lastPtr;
- if (l1->lastPtr != NULL) {
+ if (l1->lastPtr != NULL)
l1->lastPtr->nextPtr = l2->firstPtr;
- } else {
+ else
l1->firstPtr = l2->firstPtr;
- }
l1->lastPtr = l2->lastPtr;
}
}
diff --git a/usr.bin/make/lst.lib/lstDeQueue.c b/usr.bin/make/lst.lib/lstDeQueue.c
index 3c09db5e7dc..272e8a41ebe 100644
--- a/usr.bin/make/lst.lib/lstDeQueue.c
+++ b/usr.bin/make/lst.lib/lstDeQueue.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstDeQueue.c,v 1.10 2000/09/14 13:32:09 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstDeQueue.c,v 1.11 2001/05/03 13:41:19 espie Exp $ */
/* $NetBSD: lstDeQueue.c,v 1.5 1996/11/06 17:59:36 christos Exp $ */
/*
@@ -43,43 +44,46 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstDeQueue.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstDeQueue.c,v 1.10 2000/09/14 13:32:09 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstDeQueue.c,v 1.11 2001/05/03 13:41:19 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_DeQueue --
* Remove and return the datum at the head of the given list.
*
* Results:
- * The datum in the node at the head or (ick) NULL if the list
- * is empty.
+ * The datum in the node at the head or NULL if the list is empty.
*
* Side Effects:
* The head node is removed from the list.
- *
*-----------------------------------------------------------------------
*/
void *
Lst_DeQueue(l)
- Lst l;
+ Lst l;
{
- void *rd;
- LstNode tln;
+ void *rd;
+ LstNode tln;
- tln = Lst_First(l);
+ tln = l->firstPtr;
if (tln == NULL)
return NULL;
rd = tln->datum;
- Lst_Remove(l, tln);
+ l->firstPtr = tln->nextPtr;
+ if (l->firstPtr)
+ l->firstPtr->prevPtr = NULL;
+ else
+ l->lastPtr = NULL;
+ free(tln);
return rd;
}
diff --git a/usr.bin/make/lst.lib/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c
index cae5dbed8f8..73f8aa108ed 100644
--- a/usr.bin/make/lst.lib/lstDestroy.c
+++ b/usr.bin/make/lst.lib/lstDestroy.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstDestroy.c,v 1.11 2000/09/14 13:32:09 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstDestroy.c,v 1.12 2001/05/03 13:41:19 espie Exp $ */
/* $NetBSD: lstDestroy.c,v 1.6 1996/11/06 17:59:37 christos Exp $ */
/*
@@ -43,16 +44,17 @@
*/
#include "lstInt.h"
+#include <stdio.h>
+
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstDestroy.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstDestroy.c,v 1.11 2000/09/14 13:32:09 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstDestroy.c,v 1.12 2001/05/03 13:41:19 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Destroy --
@@ -67,7 +69,7 @@ static char rcsid[] = "$OpenBSD: lstDestroy.c,v 1.11 2000/09/14 13:32:09 espie E
*/
void
Lst_Destroy(l, freeProc)
- Lst l;
+ Lst l;
SimpleProc freeProc;
{
LstNode ln;
@@ -86,3 +88,4 @@ Lst_Destroy(l, freeProc)
}
}
}
+
diff --git a/usr.bin/make/lst.lib/lstDupl.c b/usr.bin/make/lst.lib/lstDupl.c
index d8e28c0915a..55abac5ad87 100644
--- a/usr.bin/make/lst.lib/lstDupl.c
+++ b/usr.bin/make/lst.lib/lstDupl.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstDupl.c,v 1.13 2000/09/14 13:32:09 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstDupl.c,v 1.14 2001/05/03 13:41:20 espie Exp $ */
/* $NetBSD: lstDupl.c,v 1.6 1996/11/06 17:59:37 christos Exp $ */
/*
@@ -44,16 +45,16 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstDupl.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstDupl.c,v 1.13 2000/09/14 13:32:09 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstDupl.c,v 1.14 2001/05/03 13:41:20 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Clone --
@@ -61,7 +62,7 @@ static char rcsid[] = "$OpenBSD: lstDupl.c,v 1.13 2000/09/14 13:32:09 espie Exp
* given, the individual client elements will be duplicated as well.
*
* Results:
- * Returns the new list.
+ * returns the new list.
*
* Side Effects:
* The new list is created.
@@ -69,20 +70,20 @@ static char rcsid[] = "$OpenBSD: lstDupl.c,v 1.13 2000/09/14 13:32:09 espie Exp
*/
Lst
Lst_Clone(nl, l, copyProc)
- Lst nl;
- Lst l;
- DuplicateProc copyProc;
+ Lst nl;
+ Lst l; /* the list to duplicate */
+ DuplicateProc copyProc; /* A function to duplicate each void * */
{
- LstNode ln;
+ LstNode ln;
Lst_Init(nl);
for (ln = l->firstPtr; ln != NULL; ln = ln->nextPtr) {
- if (copyProc != NOCOPY)
+ if (copyProc != NOCOPY)
Lst_AtEnd(nl, (*copyProc)(ln->datum));
else
Lst_AtEnd(nl, ln->datum);
}
-
return nl;
}
+
diff --git a/usr.bin/make/lst.lib/lstEnQueue.c b/usr.bin/make/lst.lib/lstEnQueue.c
deleted file mode 100644
index 5cd86f1147c..00000000000
--- a/usr.bin/make/lst.lib/lstEnQueue.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: lstEnQueue.c,v 1.8 2000/09/14 13:32:09 espie Exp $ */
-/* $NetBSD: lstEnQueue.c,v 1.5 1996/11/06 17:59:38 christos Exp $ */
-
-/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*-
- * LstEnQueue.c--
- * Treat the list as a queue and place a datum at its end
- */
-
-#include "lstInt.h"
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lstEnQueue.c 8.1 (Berkeley) 6/6/93";
-#else
-UNUSED
-static char rcsid[] = "$OpenBSD: lstEnQueue.c,v 1.8 2000/09/14 13:32:09 espie Exp $";
-#endif
-#endif /* not lint */
-
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_EnQueue --
- * Add the datum to the tail of the given list.
- *
- * Side Effects:
- * the lastPtr field is altered all the time and the firstPtr field
- * will be altered if the list used to be empty.
- *
- *-----------------------------------------------------------------------
- */
-void
-Lst_EnQueue(l, d)
- Lst l;
- void *d;
-{
- Lst_AtEnd(l, d);
-}
-
diff --git a/usr.bin/make/lst.lib/lstFindFrom.c b/usr.bin/make/lst.lib/lstFindFrom.c
index 680257061e5..05e18146f76 100644
--- a/usr.bin/make/lst.lib/lstFindFrom.c
+++ b/usr.bin/make/lst.lib/lstFindFrom.c
@@ -1,5 +1,6 @@
-/* $OpenBSD: lstFindFrom.c,v 1.9 2000/09/14 13:32:09 espie Exp $ */
-/* $NetBSD: lstFindFrom.c,v 1.6 1996/11/06 17:59:40 christos Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstFindFrom.c,v 1.10 2001/05/03 13:41:21 espie Exp $ */
+/* $NetBSD: lstFindFrom.c,v 1.6 1996/11/06 17:59:40 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -43,40 +44,39 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstFindFrom.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char *rcsid = "$OpenBSD: lstFindFrom.c,v 1.9 2000/09/14 13:32:09 espie Exp $";
+static char *rcsid = "$OpenBSD: lstFindFrom.c,v 1.10 2001/05/03 13:41:21 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_FindFrom --
- * Search for a node through a list, starting with the given node,
- * using the comparison function and passed datum to determine when
- * it has been found.
+ * Search for a node starting and ending with the given one on the
+ * given list using the passed datum and comparison function to
+ * determine when it has been found.
*
* Results:
- * The node if found, or NULL
- *
- * Side Effects:
- * Whatever cProc incurs.
+ * The found node or NULL
*-----------------------------------------------------------------------
*/
LstNode
Lst_FindFrom(ln, cProc, d)
- LstNode ln;
- FindProc cProc;
- void *d;
+ LstNode ln;
+ FindProc cProc;
+ void *d;
{
- LstNode tln;
+ LstNode tln;
for (tln = ln; tln != NULL; tln = tln->nextPtr)
- if ((*cProc)(tln->datum, d) == 0)
+ if ((*cProc)(tln->datum, d) == 0)
return tln;
+
return NULL;
}
+
diff --git a/usr.bin/make/lst.lib/lstForEachFrom.c b/usr.bin/make/lst.lib/lstForEachFrom.c
index d3b352d7376..dfff0580f73 100644
--- a/usr.bin/make/lst.lib/lstForEachFrom.c
+++ b/usr.bin/make/lst.lib/lstForEachFrom.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstForEachFrom.c,v 1.9 2000/09/14 13:32:09 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstForEachFrom.c,v 1.10 2001/05/03 13:41:21 espie Exp $ */
/* $NetBSD: lstForEachFrom.c,v 1.5 1996/11/06 17:59:42 christos Exp $ */
/*
@@ -44,45 +45,47 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstForEachFrom.c,v 1.9 2000/09/14 13:32:09 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstForEachFrom.c,v 1.10 2001/05/03 13:41:21 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_ForEachFrom --
- * Apply the given function to each element of the given list.
+ * 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.
*
* Side Effects:
* Only those created by the passed-in function.
- *
*-----------------------------------------------------------------------
*/
void
Lst_ForEachFrom(ln, proc, d)
- LstNode ln;
- ForEachProc proc;
+ LstNode ln;
+ ForEachProc proc;
void *d;
{
- LstNode tln;
+ LstNode tln;
for (tln = ln; tln != NULL; tln = tln->nextPtr)
- (*proc)(tln->datum, d);
+ (*proc)(tln->datum, d);
}
void
Lst_Every(l, proc)
- Lst l;
- SimpleProc proc;
+ Lst l;
+ SimpleProc proc;
{
- LstNode tln;
+ LstNode tln;
- for (tln = Lst_First(l); tln != NULL; tln = tln->nextPtr)
- (*proc)(tln->datum);
+ for (tln = l->firstPtr; tln != NULL; tln = tln->nextPtr)
+ (*proc)(tln->datum);
}
+
diff --git a/usr.bin/make/lst.lib/lstInit.c b/usr.bin/make/lst.lib/lstInit.c
index 1e4cdcd9b41..fec822b7ec4 100644
--- a/usr.bin/make/lst.lib/lstInit.c
+++ b/usr.bin/make/lst.lib/lstInit.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstInit.c,v 1.10 2000/09/14 13:32:09 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstInit.c,v 1.11 2001/05/03 13:41:21 espie Exp $ */
/* $NetBSD: lstInit.c,v 1.5 1996/11/06 17:59:43 christos Exp $ */
/*
@@ -43,20 +44,20 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstInit.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstInit.c,v 1.10 2000/09/14 13:32:09 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstInit.c,v 1.11 2001/05/03 13:41:21 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Init --
- * Initialize a new list.
+ * Create and initialize a new list.
*-----------------------------------------------------------------------
*/
void
@@ -65,6 +66,5 @@ Lst_Init(l)
{
l->firstPtr = NULL;
l->lastPtr = NULL;
- l->isOpen = FALSE;
- l->atEnd = Unknown;
}
+
diff --git a/usr.bin/make/lst.lib/lstInsert.c b/usr.bin/make/lst.lib/lstInsert.c
index 356393f7d92..6337f4e17e2 100644
--- a/usr.bin/make/lst.lib/lstInsert.c
+++ b/usr.bin/make/lst.lib/lstInsert.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstInsert.c,v 1.11 2000/09/14 13:32:09 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstInsert.c,v 1.12 2001/05/03 13:41:21 espie Exp $ */
/* $NetBSD: lstInsert.c,v 1.5 1996/11/06 17:59:44 christos Exp $ */
/*
@@ -43,22 +44,25 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
-static char sccsid[] = "@(#)lstInsert.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)lstInsert.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstInsert.c,v 1.11 2000/09/14 13:32:09 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstInsert.c,v 1.12 2001/05/03 13:41:21 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Insert --
* Insert a new node with the given piece of data before the given
* node in the given list.
*
+ * Results:
+ * SUCCESS or FAILURE.
+ *
* Side Effects:
* the firstPtr field will be changed if ln is the first node in the
* list.
@@ -67,27 +71,22 @@ static char rcsid[] = "$OpenBSD: lstInsert.c,v 1.11 2000/09/14 13:32:09 espie Ex
*/
void
Lst_Insert(l, ln, d)
- Lst l; /* list to manipulate */
- LstNode ln; /* node before which to insert d */
+ Lst l; /* list to manipulate */
+ LstNode ln; /* node before which to insert d */
void *d; /* datum to be inserted */
{
- LstNode nLNode; /* new lnode for d */
+ LstNode nLNode; /* new lnode for d */
- /*
- * check validity of arguments
- */
- if (LstIsEmpty(l) && ln == NULL)
- goto ok;
+ if (ln == NULL && !Lst_IsEmpty(l))
+ return;
- if (LstIsEmpty(l) || !LstNodeValid(ln, l))
+ if (ln != NULL && Lst_IsEmpty(l))
return;
- ok:
PAlloc(nLNode, LstNode);
nLNode->datum = d;
- nLNode->useCount = nLNode->flags = 0;
if (ln == NULL) {
nLNode->prevPtr = nLNode->nextPtr = NULL;
@@ -105,3 +104,21 @@ Lst_Insert(l, ln, d)
}
}
+void
+Lst_AtFront(l, d)
+ Lst l;
+ void *d;
+{
+ LstNode ln;
+
+ PAlloc(ln, LstNode);
+ ln->datum = d;
+
+ ln->nextPtr = l->firstPtr;
+ ln->prevPtr = NULL;
+ if (l->firstPtr == NULL)
+ l->lastPtr = ln;
+ else
+ l->firstPtr->prevPtr = ln;
+ l->firstPtr = ln;
+}
diff --git a/usr.bin/make/lst.lib/lstInt.h b/usr.bin/make/lst.lib/lstInt.h
index 78c5db8d65f..3b616769489 100644
--- a/usr.bin/make/lst.lib/lstInt.h
+++ b/usr.bin/make/lst.lib/lstInt.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstInt.h,v 1.11 2000/06/17 14:43:40 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstInt.h,v 1.12 2001/05/03 13:41:22 espie Exp $ */
/* $NetBSD: lstInt.h,v 1.7 1996/11/06 17:59:44 christos Exp $ */
/*
@@ -50,27 +51,9 @@
#include "lst.h"
/*
- * Flags required for synchronization
- */
-#define LN_DELETED 0x0001 /* List node should be removed when done */
-
-
-/*
- * PAlloc (var, ptype) --
+ * PAlloc(var, ptype) --
* Allocate a pointer-typedef structure 'ptype' into the variable 'var'
*/
-#define PAlloc(var,ptype) var = (ptype) emalloc (sizeof (*var))
-
-/*
- * LstNodeValid (ln, l) --
- * Return TRUE if the LstNode ln is valid with respect to l
- */
-#define LstNodeValid(ln, l) ((ln) == NULL ? FALSE : TRUE)
-
-/*
- * LstIsEmpty (l) --
- * TRUE if the list l is empty.
- */
-#define LstIsEmpty(l) ((l)->firstPtr == NULL)
+#define PAlloc(var,ptype) var = (ptype) emalloc (sizeof (*var))
#endif /* _LSTINT_H_ */
diff --git a/usr.bin/make/lst.lib/lstIsAtEnd.c b/usr.bin/make/lst.lib/lstIsAtEnd.c
deleted file mode 100644
index 29eb4fdc81c..00000000000
--- a/usr.bin/make/lst.lib/lstIsAtEnd.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: lstIsAtEnd.c,v 1.7 2000/09/14 13:32:09 espie Exp $ */
-/* $NetBSD: lstIsAtEnd.c,v 1.5 1996/11/06 17:59:45 christos Exp $ */
-
-/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*-
- * LstIsAtEnd.c --
- * Tell if the current node is at the end of the list.
- * The sequential functions access the list in a slightly different way.
- * CurPtr points to their idea of the current node in the list and they
- * access the list based on it. Because the list is circular, Lst_Next
- * and Lst_Prev will go around the list forever. Lst_IsAtEnd must be
- * used to determine when to stop.
- */
-
-#include "lstInt.h"
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lstIsAtEnd.c 8.1 (Berkeley) 6/6/93";
-#else
-UNUSED
-static char rcsid[] = "$OpenBSD: lstIsAtEnd.c,v 1.7 2000/09/14 13:32:09 espie Exp $";
-#endif
-#endif /* not lint */
-
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_IsAtEnd --
- * Return true if have reached the end of the given list.
- *
- * Results:
- * TRUE if at the end of the list (this includes the list not being
- * open or being invalid) or FALSE if not. We return TRUE if the list
- * is invalid or unopend so as to cause the caller to exit its loop
- * asap, the assumption being that the loop is of the form
- * while (!Lst_IsAtEnd (l)) {
- * ...
- * }
- *-----------------------------------------------------------------------
- */
-Boolean
-Lst_IsAtEnd(l)
- Lst l;
-{
- return !l->isOpen || l->atEnd == Head || l->atEnd == Tail;
-}
-
diff --git a/usr.bin/make/lst.lib/lstIsEmpty.c b/usr.bin/make/lst.lib/lstIsEmpty.c
deleted file mode 100644
index 29b18a9f27c..00000000000
--- a/usr.bin/make/lst.lib/lstIsEmpty.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: lstIsEmpty.c,v 1.7 2000/09/14 13:32:09 espie Exp $ */
-/* $NetBSD: lstIsEmpty.c,v 1.5 1996/11/06 17:59:47 christos Exp $ */
-
-/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*-
- * LstIsEmpty.c --
- * A single function to decide if a list is empty
- */
-
-#include "lstInt.h"
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lstIsEmpty.c 8.1 (Berkeley) 6/6/93";
-#else
-UNUSED
-static char rcsid[] = "$OpenBSD: lstIsEmpty.c,v 1.7 2000/09/14 13:32:09 espie Exp $";
-#endif
-#endif /* not lint */
-
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_IsEmpty --
- * Return TRUE if the given list is empty.
- *-----------------------------------------------------------------------
- */
-Boolean
-Lst_IsEmpty(l)
- Lst l;
-{
- return LstIsEmpty(l);
-}
-
diff --git a/usr.bin/make/lst.lib/lstMember.c b/usr.bin/make/lst.lib/lstMember.c
index b78ce79f10d..294aab46816 100644
--- a/usr.bin/make/lst.lib/lstMember.c
+++ b/usr.bin/make/lst.lib/lstMember.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstMember.c,v 1.8 2000/09/14 13:32:09 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstMember.c,v 1.9 2001/05/03 13:41:23 espie Exp $ */
/* $NetBSD: lstMember.c,v 1.5 1996/11/06 17:59:48 christos Exp $ */
/*
@@ -43,22 +44,22 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
-static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstMember.c,v 1.8 2000/09/14 13:32:09 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstMember.c,v 1.9 2001/05/03 13:41:23 espie Exp $";
#endif
#endif /* not lint */
-
LstNode
Lst_Member(l, d)
- Lst l;
+ Lst l;
void *d;
{
- LstNode lNode;
+ LstNode lNode;
for (lNode = l->firstPtr; lNode != NULL; lNode = lNode->nextPtr)
if (lNode->datum == d)
diff --git a/usr.bin/make/lst.lib/lstNext.c b/usr.bin/make/lst.lib/lstNext.c
deleted file mode 100644
index 902a6de1029..00000000000
--- a/usr.bin/make/lst.lib/lstNext.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $OpenBSD: lstNext.c,v 1.8 2000/09/14 13:32:10 espie Exp $ */
-/* $NetBSD: lstNext.c,v 1.5 1996/11/06 17:59:49 christos Exp $ */
-
-/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*-
- * LstNext.c --
- * Return the next node for a list.
- * The sequential functions access the list in a slightly different way.
- * CurPtr points to their idea of the current node in the list and they
- * access the list based on it. Because the list is circular, Lst_Next
- * and Lst_Prev will go around the list forever. Lst_IsAtEnd must be
- * used to determine when to stop.
- */
-
-#include "lstInt.h"
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lstNext.c 8.1 (Berkeley) 6/6/93";
-#else
-UNUSED
-static char rcsid[] = "$OpenBSD: lstNext.c,v 1.8 2000/09/14 13:32:10 espie Exp $";
-#endif
-#endif /* not lint */
-
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_Next --
- * Return the next node for the given list.
- *
- * Results:
- * The next node or NULL if the list has yet to be opened. Also
- * if the list is non-circular and the end has been reached, NULL
- * is returned.
- *
- * Side Effects:
- * the curPtr field is updated.
- *
- *-----------------------------------------------------------------------
- */
-LstNode
-Lst_Next(l)
- Lst l;
-{
- LstNode tln;
-
- if (l->isOpen == FALSE)
- return NULL;
-
- l->prevPtr = l->curPtr;
-
- if (l->curPtr == NULL) {
- if (l->atEnd == Unknown) {
- /*
- * If we're just starting out, atEnd will be Unknown.
- * Then we want to start this thing off in the right
- * direction -- at the start with atEnd being Middle.
- */
- l->curPtr = tln = l->firstPtr;
- l->atEnd = Middle;
- } else {
- tln = NULL;
- l->atEnd = Tail;
- }
- } else {
- tln = l->curPtr->nextPtr;
- l->curPtr = tln;
-
- if (tln == l->firstPtr || tln == NULL)
- /*
- * If back at the front, then we've hit the end...
- */
- l->atEnd = Tail;
- else
- /*
- * Reset to Middle if gone past first.
- */
- l->atEnd = Middle;
- }
-
- return tln;
-}
-
diff --git a/usr.bin/make/lst.lib/lstOpen.c b/usr.bin/make/lst.lib/lstOpen.c
deleted file mode 100644
index 08e0f4f56c9..00000000000
--- a/usr.bin/make/lst.lib/lstOpen.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: lstOpen.c,v 1.9 2000/09/14 13:32:10 espie Exp $ */
-/* $NetBSD: lstOpen.c,v 1.5 1996/11/06 17:59:50 christos Exp $ */
-
-/*
- * Copyright (c) 1988, 1989, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*-
- * LstOpen.c --
- * Open a list for sequential access. The sequential functions access the
- * list in a slightly different way. CurPtr points to their idea of the
- * current node in the list and they access the list based on it.
- * If the list is circular, Lst_Next and Lst_Prev will go around
- * the list forever. Lst_IsAtEnd must be used to determine when to stop.
- */
-
-#include "lstInt.h"
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)lstOpen.c 8.1 (Berkeley) 6/6/93";
-#else
-UNUSED
-static char rcsid[] = "$OpenBSD: lstOpen.c,v 1.9 2000/09/14 13:32:10 espie Exp $";
-#endif
-#endif /* not lint */
-
-
-/*-
- *-----------------------------------------------------------------------
- * Lst_Open --
- * Open a list for sequential access. A list can still be searched,
- * etc., without confusing these functions.
- *
- * Side Effects:
- * isOpen is set TRUE and curPtr is set to NULL so the
- * other sequential functions no it was just opened and can choose
- * the first element accessed based on this.
- *
- *-----------------------------------------------------------------------
- */
-void
-Lst_Open(l)
- Lst l;
-{
- l->isOpen = TRUE;
- l->atEnd = LstIsEmpty(l) ? Head : Unknown;
- l->curPtr = NULL;
-}
-
diff --git a/usr.bin/make/lst.lib/lstRemove.c b/usr.bin/make/lst.lib/lstRemove.c
index d4d900768df..f2be845d888 100644
--- a/usr.bin/make/lst.lib/lstRemove.c
+++ b/usr.bin/make/lst.lib/lstRemove.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstRemove.c,v 1.10 2000/09/14 13:32:10 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstRemove.c,v 1.11 2001/05/03 13:41:25 espie Exp $ */
/* $NetBSD: lstRemove.c,v 1.5 1996/11/06 17:59:50 christos Exp $ */
/*
@@ -43,24 +44,21 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
-static char sccsid[] = "@(#)lstRemove.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)lstRemove.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstRemove.c,v 1.10 2000/09/14 13:32:10 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstRemove.c,v 1.11 2001/05/03 13:41:25 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Remove --
* Remove the given node from the given list.
*
- * Results:
- * SUCCESS or FAILURE.
- *
* Side Effects:
* The list's firstPtr will be set to NULL if ln is the last
* node on the list. firsPtr and lastPtr will be altered if ln is
@@ -70,11 +68,11 @@ static char rcsid[] = "$OpenBSD: lstRemove.c,v 1.10 2000/09/14 13:32:10 espie Ex
*/
void
Lst_Remove(l, ln)
- Lst l;
- LstNode ln;
+ Lst l;
+ LstNode ln;
{
- if (!LstNodeValid(ln, l))
- return;
+ if (ln == NULL)
+ return;
/* unlink it from the list */
if (ln->nextPtr != NULL)
@@ -82,42 +80,15 @@ Lst_Remove(l, ln)
if (ln->prevPtr != NULL)
ln->prevPtr->nextPtr = ln->nextPtr;
- /*
- * if either the firstPtr or lastPtr of the list point to this node,
- * adjust them accordingly
- */
+ /* if either the firstPtr or lastPtr of the list point to this node,
+ * adjust them accordingly */
if (l->firstPtr == ln)
l->firstPtr = ln->nextPtr;
if (l->lastPtr == ln)
l->lastPtr = ln->prevPtr;
- /*
- * Sequential access stuff. If the node we're removing is the current
- * node in the list, reset the current node to the previous one. If the
- * previous one was non-existent (prevPtr == NULL), we set the
- * end to be Unknown, since it is.
- */
- if (l->isOpen && l->curPtr == ln) {
- l->curPtr = l->prevPtr;
- if (l->curPtr == NULL)
- l->atEnd = Unknown;
- }
-
- /*
- * the only way firstPtr can still point to ln is if ln is the last
- * node on the list (the list is circular, so ln->nextptr == ln in
- * this case). The list is, therefore, empty and is marked as such
- */
- if (l->firstPtr == ln)
- l->firstPtr = NULL;
-
- /*
- * note that the datum is unmolested. The caller must free it as
- * necessary and as expected.
- */
- if (ln->useCount == 0)
- free(ln);
- else
- ln->flags |= LN_DELETED;
+ /* note that the datum is unmolested. The caller must free it as
+ * necessary and as expected. */
+ free(ln);
}
diff --git a/usr.bin/make/lst.lib/lstReplace.c b/usr.bin/make/lst.lib/lstReplace.c
index 67d8796caf1..f5ec891de52 100644
--- a/usr.bin/make/lst.lib/lstReplace.c
+++ b/usr.bin/make/lst.lib/lstReplace.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstReplace.c,v 1.9 2000/09/14 13:32:10 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstReplace.c,v 1.10 2001/05/03 13:41:26 espie Exp $ */
/* $NetBSD: lstReplace.c,v 1.5 1996/11/06 17:59:51 christos Exp $ */
/*
@@ -43,31 +44,28 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstReplace.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstReplace.c,v 1.9 2000/09/14 13:32:10 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstReplace.c,v 1.10 2001/05/03 13:41:26 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Replace --
* Replace the datum in the given node with the new datum
- *
- * Side Effects:
- * The datum field fo the node is altered.
- *
*-----------------------------------------------------------------------
*/
void
Lst_Replace(ln, d)
- LstNode ln;
- void *d;
+ LstNode ln;
+ void *d;
{
- if (ln != NULL)
+ if (ln != NULL)
ln->datum = d;
}
+
diff --git a/usr.bin/make/lst.lib/lstSucc.c b/usr.bin/make/lst.lib/lstSucc.c
index d71cf026365..d6acc4816b5 100644
--- a/usr.bin/make/lst.lib/lstSucc.c
+++ b/usr.bin/make/lst.lib/lstSucc.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: lstSucc.c,v 1.7 2000/09/14 13:32:10 espie Exp $ */
+/* $OpenPackages$ */
+/* $OpenBSD: lstSucc.c,v 1.8 2001/05/03 13:41:27 espie Exp $ */
/* $NetBSD: lstSucc.c,v 1.5 1996/11/06 17:59:52 christos Exp $ */
/*
@@ -43,25 +44,24 @@
*/
#include "lstInt.h"
+
#ifndef lint
#if 0
static char sccsid[] = "@(#)lstSucc.c 8.1 (Berkeley) 6/6/93";
#else
UNUSED
-static char rcsid[] = "$OpenBSD: lstSucc.c,v 1.7 2000/09/14 13:32:10 espie Exp $";
+static char rcsid[] = "$OpenBSD: lstSucc.c,v 1.8 2001/05/03 13:41:27 espie Exp $";
#endif
#endif /* not lint */
-
/*-
*-----------------------------------------------------------------------
* Lst_Succ --
* Return the sucessor to the given node on its list.
*
* Results:
- * The successor of the node, if it exists (note that on a circular
- * list, if the node is the only one in the list, it is its own
- * successor).
+ * The successor of the node, if it exists.
+ *
*-----------------------------------------------------------------------
*/
LstNode