Changeset 24 for branches/FREEBSD/src/kmk/lst.lib/lstConcat.c
- Timestamp:
- Nov 26, 2002, 10:24:54 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/FREEBSD/src/kmk/lst.lib/lstConcat.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstConcat.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstConcat.c,v 1.7 1999/08/28 01:03:47 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstConcat.c,v 1.11 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstConcat.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 85 84 86 85 if (flags == LST_CONCLINK) { 87 if (list2->firstPtr != N ULL) {86 if (list2->firstPtr != NilListNode) { 88 87 /* 89 88 * We set the nextPtr of the 90 * last element of list two to be N ULL to make the loop easier and89 * last element of list two to be NIL to make the loop easier and 91 90 * so we don't need an extra case should the first list turn 92 91 * out to be non-circular -- the final element will already point 93 * to N ULL space and the first element will be untouched if it94 * existed before and will also point to N ULL space if it didn't.92 * to NIL space and the first element will be untouched if it 93 * existed before and will also point to NIL space if it didn't. 95 94 */ 96 list2->lastPtr->nextPtr = N ULL;95 list2->lastPtr->nextPtr = NilListNode; 97 96 /* 98 97 * So long as the second list isn't empty, we just link the … … 104 103 */ 105 104 list2->firstPtr->prevPtr = list1->lastPtr; 106 if (list1->lastPtr != N ULL) {105 if (list1->lastPtr != NilListNode) { 107 106 list1->lastPtr->nextPtr = list2->firstPtr; 108 107 } else { … … 111 110 list1->lastPtr = list2->lastPtr; 112 111 } 113 if (list1->isCirc && list1->firstPtr != N ULL) {112 if (list1->isCirc && list1->firstPtr != NilListNode) { 114 113 /* 115 114 * If the first list is supposed to be circular and it is (now) … … 120 119 list1->lastPtr->nextPtr = list1->firstPtr; 121 120 } 122 free ( l2);123 } else if (list2->firstPtr != N ULL) {121 free ((Address)l2); 122 } else if (list2->firstPtr != NilListNode) { 124 123 /* 125 * We set the nextPtr of the last element of list 2 to be NULLto make124 * We set the nextPtr of the last element of list 2 to be nil to make 126 125 * the loop less difficult. The loop simply goes through the entire 127 126 * second list creating new LstNodes and filling in the nextPtr, and … … 130 129 * follows the last of the new nodes along until the entire l2 has 131 130 * been appended. Only then does the bookkeeping catch up with the 132 * changes. During the first iteration of the loop, if 'last' is NULL,131 * changes. During the first iteration of the loop, if 'last' is nil, 133 132 * the first list must have been empty so the newly-created node is 134 133 * made the first node of the list. 135 134 */ 136 list2->lastPtr->nextPtr = N ULL;135 list2->lastPtr->nextPtr = NilListNode; 137 136 for (last = list1->lastPtr, ln = list2->firstPtr; 138 ln != N ULL;137 ln != NilListNode; 139 138 ln = ln->nextPtr) 140 139 { 141 140 PAlloc (nln, ListNode); 142 141 nln->datum = ln->datum; 143 if (last != N ULL) {142 if (last != NilListNode) { 144 143 last->nextPtr = nln; 145 144 } else { … … 167 166 list1->firstPtr->prevPtr = list1->lastPtr; 168 167 } else { 169 last->nextPtr = N ULL;168 last->nextPtr = NilListNode; 170 169 } 171 170
Note:
See TracChangeset
for help on using the changeset viewer.