summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/lst.lib/lstConcat.c
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2004-12-07 10:14:16 +0000
committerharti <harti@FreeBSD.org>2004-12-07 10:14:16 +0000
commite65ea2146d73aa6aedf8ef3fb0fd535039da6887 (patch)
treedc544ee893c2b95a0e4d64009cb9fe98b5598e7c /usr.bin/make/lst.lib/lstConcat.c
parent4a639d6164f667049cce0046d22e760ca1aad3f2 (diff)
downloadFreeBSD-src-e65ea2146d73aa6aedf8ef3fb0fd535039da6887.zip
FreeBSD-src-e65ea2146d73aa6aedf8ef3fb0fd535039da6887.tar.gz
Make needs no circular lists so remove them from the list code.
Diffstat (limited to 'usr.bin/make/lst.lib/lstConcat.c')
-rw-r--r--usr.bin/make/lst.lib/lstConcat.c38
1 files changed, 6 insertions, 32 deletions
diff --git a/usr.bin/make/lst.lib/lstConcat.c b/usr.bin/make/lst.lib/lstConcat.c
index f0c771c..5391796 100644
--- a/usr.bin/make/lst.lib/lstConcat.c
+++ b/usr.bin/make/lst.lib/lstConcat.c
@@ -87,12 +87,11 @@ Lst_Concat(Lst list1, Lst list2, int flags)
if (flags == LST_CONCLINK) {
if (list2->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.
+ * 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 --
+ * 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.
*/
list2->lastPtr->nextPtr = NULL;
/*
@@ -111,15 +110,6 @@ Lst_Concat(Lst list1, Lst list2, int flags)
}
list1->lastPtr = list2->lastPtr;
}
- if (list1->isCirc && list1->firstPtr != NULL) {
- /*
- * If the first list is supposed to be circular and it is (now)
- * non-empty, we must make sure it's circular by linking the
- * first element to the last and vice versa
- */
- list1->firstPtr->prevPtr = list1->lastPtr;
- list1->lastPtr->nextPtr = list1->firstPtr;
- }
free(list2);
} else if (list2->firstPtr != NULL) {
/*
@@ -156,23 +146,7 @@ Lst_Concat(Lst list1, Lst list2, int flags)
* of list one.
*/
list1->lastPtr = last;
-
- /*
- * The circularity of both list one and list two must be corrected
- * for -- list one because of the new nodes added to it; list two
- * because of the alteration of list2->lastPtr's nextPtr to ease the
- * above for loop.
- */
- if (list1->isCirc) {
- list1->lastPtr->nextPtr = list1->firstPtr;
- list1->firstPtr->prevPtr = list1->lastPtr;
- } else {
- last->nextPtr = NULL;
- }
-
- if (list2->isCirc) {
- list2->lastPtr->nextPtr = list2->firstPtr;
- }
+ last->nextPtr = NULL;
}
return (SUCCESS);
OpenPOWER on IntegriCloud