Changeset 24 in kBuild for branches/FREEBSD/src/kmk/lst.lib
- Timestamp:
- Nov 26, 2002 9:24:54 PM (22 years ago)
- Location:
- branches/FREEBSD/src/kmk/lst.lib
- Files:
-
- 27 edited
-
lstAppend.c (modified) (6 diffs)
-
lstAtEnd.c (modified) (2 diffs)
-
lstAtFront.c (modified) (2 diffs)
-
lstClose.c (modified) (1 diff)
-
lstConcat.c (modified) (7 diffs)
-
lstDatum.c (modified) (3 diffs)
-
lstDeQueue.c (modified) (3 diffs)
-
lstDestroy.c (modified) (3 diffs)
-
lstDupl.c (modified) (4 diffs)
-
lstEnQueue.c (modified) (2 diffs)
-
lstFind.c (modified) (3 diffs)
-
lstFindFrom.c (modified) (5 diffs)
-
lstFirst.c (modified) (3 diffs)
-
lstForEach.c (modified) (2 diffs)
-
lstForEachFrom.c (modified) (3 diffs)
-
lstInit.c (modified) (2 diffs)
-
lstInsert.c (modified) (5 diffs)
-
lstInt.h (modified) (7 diffs)
-
lstIsAtEnd.c (modified) (1 diff)
-
lstIsEmpty.c (modified) (2 diffs)
-
lstLast.c (modified) (3 diffs)
-
lstMember.c (modified) (4 diffs)
-
lstNext.c (modified) (5 diffs)
-
lstOpen.c (modified) (3 diffs)
-
lstRemove.c (modified) (6 diffs)
-
lstReplace.c (modified) (2 diffs)
-
lstSucc.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/FREEBSD/src/kmk/lst.lib/lstAppend.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstAppend.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstAppend.c,v 1.6 1999/08/28 01:03:45 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstAppend.c,v 1.10 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstAppend.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 61 60 * field of the List will be altered if ln is the last node in the 62 61 * list. lastPtr and firstPtr will alter if the list was empty and 63 * ln was N ULL.62 * ln was NILLNODE. 64 63 * 65 64 *----------------------------------------------------------------------- … … 69 68 Lst l; /* affected list */ 70 69 LstNode ln; /* node after which to append the datum */ 71 void *d; /* said datum */70 ClientData d; /* said datum */ 72 71 { 73 72 register List list; … … 75 74 register ListNode nLNode; 76 75 77 if (LstValid (l) && (ln == N ULL&& LstIsEmpty (l))) {76 if (LstValid (l) && (ln == NILLNODE && LstIsEmpty (l))) { 78 77 goto ok; 79 78 } … … 91 90 nLNode->useCount = nLNode->flags = 0; 92 91 93 if (lNode == N ULL) {92 if (lNode == NilListNode) { 94 93 if (list->isCirc) { 95 94 nLNode->nextPtr = nLNode->prevPtr = nLNode; 96 95 } else { 97 nLNode->nextPtr = nLNode->prevPtr = N ULL;96 nLNode->nextPtr = nLNode->prevPtr = NilListNode; 98 97 } 99 98 list->firstPtr = list->lastPtr = nLNode; … … 103 102 104 103 lNode->nextPtr = nLNode; 105 if (nLNode->nextPtr != N ULL) {104 if (nLNode->nextPtr != NilListNode) { 106 105 nLNode->nextPtr->prevPtr = nLNode; 107 106 } -
branches/FREEBSD/src/kmk/lst.lib/lstAtEnd.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstAtEnd.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstAtEnd.c,v 1.6 1999/08/28 01:03:46 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstAtEnd.c,v 1.9 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstAtEnd.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 65 64 Lst_AtEnd (l, d) 66 65 Lst l; /* List to which to add the datum */ 67 void *d; /* Datum to add */66 ClientData d; /* Datum to add */ 68 67 { 69 68 register LstNode end; -
branches/FREEBSD/src/kmk/lst.lib/lstAtFront.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstAtFront.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstAtFront.c,v 1.6 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/lstAtFront.c,v 1.9 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstAtFront.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 66 65 Lst_AtFront (l, d) 67 66 Lst l; 68 void *d;67 ClientData d; 69 68 { 70 69 register LstNode front; -
branches/FREEBSD/src/kmk/lst.lib/lstClose.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstClose.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstClose.c,v 1.6 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/lstClose.c,v 1.8 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstClose.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 -
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 -
branches/FREEBSD/src/kmk/lst.lib/lstDatum.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstDatum.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstDatum.c,v 1.5 1999/08/28 01:03:48 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstDatum.c,v 1.9 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstDatum.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 55 54 * 56 55 * Results: 57 * The datum or (ick!) N ULL if the node is invalid.56 * The datum or (ick!) NIL if the node is invalid. 58 57 * 59 58 * Side Effects: … … 62 61 *----------------------------------------------------------------------- 63 62 */ 64 void * 63 ClientData 65 64 Lst_Datum (ln) 66 65 LstNode ln; 67 66 { 68 if (ln != N ULL) {67 if (ln != NILLNODE) { 69 68 return (((ListNode)ln)->datum); 70 69 } else { 71 return (( void *) NULL);70 return ((ClientData) NIL); 72 71 } 73 72 } -
branches/FREEBSD/src/kmk/lst.lib/lstDeQueue.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstDeQueue.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstDeQueue.c,v 1.6 1999/08/28 01:03:48 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstDeQueue.c,v 1.10 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstDeQueue.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 55 54 * 56 55 * Results: 57 * The datum in the node at the head or (ick) N ULL if the list56 * The datum in the node at the head or (ick) NIL if the list 58 57 * is empty. 59 58 * … … 63 62 *----------------------------------------------------------------------- 64 63 */ 65 void * 64 ClientData 66 65 Lst_DeQueue (l) 67 66 Lst l; 68 67 { 69 void *rd;68 ClientData rd; 70 69 register ListNode tln; 71 70 72 71 tln = (ListNode) Lst_First (l); 73 if (tln == N ULL) {74 return (( void *) NULL);72 if (tln == NilListNode) { 73 return ((ClientData) NIL); 75 74 } 76 75 77 76 rd = tln->datum; 78 77 if (Lst_Remove (l, (LstNode)tln) == FAILURE) { 79 return (( void *) NULL);78 return ((ClientData) NIL); 80 79 } else { 81 80 return (rd); -
branches/FREEBSD/src/kmk/lst.lib/lstDestroy.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstDestroy.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstDestroy.c,v 1.7 1999/08/28 01:03:49 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstDestroy.c,v 1.12 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstDestroy.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 67 66 Lst_Destroy (l, freeProc) 68 67 Lst l; 69 register void (*freeProc) (void *);68 register void (*freeProc) __P((ClientData)); 70 69 { 71 70 register ListNode ln; 72 register ListNode tln = N ULL;71 register ListNode tln = NilListNode; 73 72 register List list = (List)l; 74 73 75 if (l == N ULL|| ! l) {74 if (l == NILLST || ! l) { 76 75 /* 77 76 * Note the check for l == (Lst)0 to catch uninitialized static Lst's. … … 82 81 83 82 /* To ease scanning */ 84 if (list->lastPtr != N ULL)85 list->lastPtr->nextPtr = N ULL;83 if (list->lastPtr != NilListNode) 84 list->lastPtr->nextPtr = NilListNode; 86 85 else { 87 free ( l);86 free ((Address)l); 88 87 return; 89 88 } 90 89 91 90 if (freeProc) { 92 for (ln = list->firstPtr; ln != N ULL; ln = tln) {91 for (ln = list->firstPtr; ln != NilListNode; ln = tln) { 93 92 tln = ln->nextPtr; 94 93 (*freeProc) (ln->datum); 95 free ( ln);94 free ((Address)ln); 96 95 } 97 96 } else { 98 for (ln = list->firstPtr; ln != N ULL; ln = tln) {97 for (ln = list->firstPtr; ln != NilListNode; ln = tln) { 99 98 tln = ln->nextPtr; 100 free ( ln);99 free ((Address)ln); 101 100 } 102 101 } 103 102 104 free ( l);103 free ((Address)l); 105 104 } -
branches/FREEBSD/src/kmk/lst.lib/lstDupl.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstDupl.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstDupl.c,v 1.7 1999/08/28 01:03:49 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstDupl.c,v 1.12 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstDupl.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 53 52 *----------------------------------------------------------------------- 54 53 * Lst_Duplicate -- 55 * Duplicate an entire list. If a function to copy a void *is54 * Duplicate an entire list. If a function to copy a ClientData is 56 55 * given, the individual client elements will be duplicated as well. 57 56 * 58 57 * Results: 59 * The new Lst structure or N ULLif failure.58 * The new Lst structure or NILLST if failure. 60 59 * 61 60 * Side Effects: … … 66 65 Lst_Duplicate (l, copyProc) 67 66 Lst l; /* the list to duplicate */ 68 /* A function to duplicate each void **/69 void * (*copyProc)(void *);67 /* A function to duplicate each ClientData */ 68 ClientData (*copyProc) __P((ClientData)); 70 69 { 71 70 register Lst nl; … … 74 73 75 74 if (!LstValid (l)) { 76 return (N ULL);75 return (NILLST); 77 76 } 78 77 79 78 nl = Lst_Init (list->isCirc); 80 if (nl == N ULL) {81 return (N ULL);79 if (nl == NILLST) { 80 return (NILLST); 82 81 } 83 82 84 83 ln = list->firstPtr; 85 while (ln != N ULL) {84 while (ln != NilListNode) { 86 85 if (copyProc != NOCOPY) { 87 86 if (Lst_AtEnd (nl, (*copyProc) (ln->datum)) == FAILURE) { 88 return (N ULL);87 return (NILLST); 89 88 } 90 89 } else if (Lst_AtEnd (nl, ln->datum) == FAILURE) { 91 return (N ULL);90 return (NILLST); 92 91 } 93 92 94 93 if (list->isCirc && ln == list->lastPtr) { 95 ln = N ULL;94 ln = NilListNode; 96 95 } else { 97 96 ln = ln->nextPtr; -
branches/FREEBSD/src/kmk/lst.lib/lstEnQueue.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstEnQueue.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstEnQueue.c,v 1.6 1999/08/28 01:03:50 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstEnQueue.c,v 1.9 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstEnQueue.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 66 65 Lst_EnQueue (l, d) 67 66 Lst l; 68 void *d;67 ClientData d; 69 68 { 70 69 if (LstValid (l) == FALSE) { -
branches/FREEBSD/src/kmk/lst.lib/lstFind.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstFind.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstFind.c,v 1.6 1999/08/28 01:03:50 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstFind.c,v 1.11 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstFind.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 56 55 * 57 56 * Results: 58 * The found node or N ULLif none matches.57 * The found node or NILLNODE if none matches. 59 58 * 60 59 * Side Effects: … … 66 65 Lst_Find (l, d, cProc) 67 66 Lst l; 68 void *d;69 int (*cProc) (void *, void *);67 ClientData d; 68 int (*cProc) __P((ClientData, ClientData)); 70 69 { 71 70 return (Lst_FindFrom (l, Lst_First(l), d, cProc)); -
branches/FREEBSD/src/kmk/lst.lib/lstFindFrom.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstFindFrom.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstFindFrom.c,v 1.7 1999/08/28 01:03:50 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstFindFrom.c,v 1.12 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstFindFrom.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 57 56 * 58 57 * Results: 59 * The found node or N ULL58 * The found node or NILLNODE 60 59 * 61 60 * Side Effects: … … 68 67 Lst l; 69 68 register LstNode ln; 70 register void *d;71 register int (*cProc) (void *, void *);69 register ClientData d; 70 register int (*cProc) __P((ClientData, ClientData)); 72 71 { 73 72 register ListNode tln; … … 75 74 76 75 if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) { 77 return (N ULL);76 return (NILLNODE); 78 77 } 79 78 … … 87 86 tln = tln->nextPtr; 88 87 } 89 } while (tln != (ListNode)ln && tln != N ULL);88 } while (tln != (ListNode)ln && tln != NilListNode); 90 89 91 90 if (found) { 92 91 return ((LstNode)tln); 93 92 } else { 94 return (N ULL);93 return (NILLNODE); 95 94 } 96 95 } -
branches/FREEBSD/src/kmk/lst.lib/lstFirst.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstFirst.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstFirst.c,v 1.5 1999/08/28 01:03:51 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstFirst.c,v 1.8 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstFirst.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 55 54 * 56 55 * Results: 57 * The first node or N ULLif the list is empty.56 * The first node or NILLNODE if the list is empty. 58 57 * 59 58 * Side Effects: … … 67 66 { 68 67 if (!LstValid (l) || LstIsEmpty (l)) { 69 return (N ULL);68 return (NILLNODE); 70 69 } else { 71 70 return ((LstNode)((List)l)->firstPtr); -
branches/FREEBSD/src/kmk/lst.lib/lstForEach.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstForEach.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstForEach.c,v 1.6 1999/08/28 01:03:51 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstForEach.c,v 1.10 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstForEach.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 68 67 Lst_ForEach (l, proc, d) 69 68 Lst l; 70 register int (*proc) (void *, void *);71 register void *d;69 register int (*proc) __P((ClientData, ClientData)); 70 register ClientData d; 72 71 { 73 72 Lst_ForEachFrom(l, Lst_First(l), proc, d); -
branches/FREEBSD/src/kmk/lst.lib/lstForEachFrom.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstForEachFrom.c,v 1.7 1999/08/28 01:03:52 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstForEachFrom.c,v 1.12 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 70 69 Lst l; 71 70 LstNode ln; 72 register int (*proc) (void *, void *);73 register void *d;71 register int (*proc) __P((ClientData, ClientData)); 72 register ClientData d; 74 73 { 75 74 register ListNode tln = (ListNode)ln; … … 102 101 */ 103 102 done = (next == tln->nextPtr && 104 (next == N ULL|| next == list->firstPtr));103 (next == NilListNode || next == list->firstPtr)); 105 104 106 105 next = tln->nextPtr; -
branches/FREEBSD/src/kmk/lst.lib/lstInit.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstInit.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstInit.c,v 1.6 1999/08/28 01:03:52 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstInit.c,v 1.9 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstInit.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 70 69 PAlloc (nList, List); 71 70 72 nList->firstPtr = N ULL;73 nList->lastPtr = N ULL;71 nList->firstPtr = NilListNode; 72 nList->lastPtr = NilListNode; 74 73 nList->isOpen = FALSE; 75 74 nList->isCirc = circ; -
branches/FREEBSD/src/kmk/lst.lib/lstInsert.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstInsert.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstInsert.c,v 1.6 1999/08/28 01:03:52 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstInsert.c,v 1.10 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstInsert.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 68 67 Lst l; /* list to manipulate */ 69 68 LstNode ln; /* node before which to insert d */ 70 void *d; /* datum to be inserted */69 ClientData d; /* datum to be inserted */ 71 70 { 72 71 register ListNode nLNode; /* new lnode for d */ … … 78 77 * check validity of arguments 79 78 */ 80 if (LstValid (l) && (LstIsEmpty (l) && ln == N ULL))79 if (LstValid (l) && (LstIsEmpty (l) && ln == NILLNODE)) 81 80 goto ok; 82 81 … … 91 90 nLNode->useCount = nLNode->flags = 0; 92 91 93 if (ln == N ULL) {92 if (ln == NILLNODE) { 94 93 if (list->isCirc) { 95 94 nLNode->prevPtr = nLNode->nextPtr = nLNode; 96 95 } else { 97 nLNode->prevPtr = nLNode->nextPtr = N ULL;96 nLNode->prevPtr = nLNode->nextPtr = NilListNode; 98 97 } 99 98 list->firstPtr = list->lastPtr = nLNode; … … 102 101 nLNode->nextPtr = lNode; 103 102 104 if (nLNode->prevPtr != N ULL) {103 if (nLNode->prevPtr != NilListNode) { 105 104 nLNode->prevPtr->nextPtr = nLNode; 106 105 } -
branches/FREEBSD/src/kmk/lst.lib/lstInt.h
r9 r24 35 35 * 36 36 * from: @(#)lstInt.h 8.1 (Berkeley) 6/6/93 37 * $FreeBSD: src/usr.bin/make/lst.lib/lstInt.h,v 1. 10 2002/07/15 06:57:25 jmallettExp $37 * $FreeBSD: src/usr.bin/make/lst.lib/lstInt.h,v 1.7 1999/08/28 01:03:53 peter Exp $ 38 38 */ 39 39 … … 51 51 struct ListNode *prevPtr; /* previous element in list */ 52 52 struct ListNode *nextPtr; /* next in list */ 53 int useCount:8, /* Count of functions using the node.53 short useCount:8, /* Count of functions using the node. 54 54 * node may not be deleted until count 55 55 * goes to 0 */ 56 56 flags:8; /* Node status flags */ 57 void *datum; /* datum associated with this element */57 ClientData datum; /* datum associated with this element */ 58 58 } *ListNode; 59 59 /* … … 61 61 */ 62 62 #define LN_DELETED 0x0001 /* List node should be removed when done */ 63 64 #define NilListNode ((ListNode)-1) 63 65 64 66 typedef enum { … … 76 78 Where atEnd; /* Where in the list the last access was */ 77 79 Boolean isOpen; /* true if list has been Lst_Open'ed */ 78 ListNode curPtr; /* current node, if open. N ULLif80 ListNode curPtr; /* current node, if open. NilListNode if 79 81 * *just* opened */ 80 82 ListNode prevPtr; /* Previous node, if open. Used by 81 83 * Lst_Remove */ 82 84 } *List; 85 86 #define NilList ((List)-1) 83 87 84 88 /* … … 92 96 * Return TRUE if the list l is valid 93 97 */ 94 #define LstValid(l) (((Lst)l == N ULL) ? FALSE : TRUE)98 #define LstValid(l) (((Lst)l == NILLST) ? FALSE : TRUE) 95 99 96 100 /* … … 98 102 * Return TRUE if the LstNode ln is valid with respect to l 99 103 */ 100 #define LstNodeValid(ln, l) ((((LstNode)ln) == N ULL) ? FALSE : TRUE)104 #define LstNodeValid(ln, l) ((((LstNode)ln) == NILLNODE) ? FALSE : TRUE) 101 105 102 106 /* … … 104 108 * TRUE if the list l is empty. 105 109 */ 106 #define LstIsEmpty(l) (((List)l)->firstPtr == N ULL)110 #define LstIsEmpty(l) (((List)l)->firstPtr == NilListNode) 107 111 108 112 #endif /* _LSTINT_H_ */ -
branches/FREEBSD/src/kmk/lst.lib/lstIsAtEnd.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstIsAtEnd.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstIsAtEnd.c,v 1.5 1999/08/28 01:03:53 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstIsAtEnd.c,v 1.7 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstIsAtEnd.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 -
branches/FREEBSD/src/kmk/lst.lib/lstIsEmpty.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstIsEmpty.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstIsEmpty.c,v 1.5 1999/08/28 01:03:54 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstIsEmpty.c,v 1.8 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstIsEmpty.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 60 59 * None. 61 60 * 62 * A list is considered empty if its firstPtr == N ULL(or if63 * the list itself is N ULLLIST).61 * A list is considered empty if its firstPtr == NilListNode (or if 62 * the list itself is NILLIST). 64 63 *----------------------------------------------------------------------- 65 64 */ -
branches/FREEBSD/src/kmk/lst.lib/lstLast.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstLast.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstLast.c,v 1.5 1999/08/28 01:03:55 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstLast.c,v 1.8 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstLast.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 55 54 * 56 55 * Results: 57 * The requested node or N ULLif the list is empty.56 * The requested node or NILLNODE if the list is empty. 58 57 * 59 58 * Side Effects: … … 67 66 { 68 67 if (!LstValid(l) || LstIsEmpty (l)) { 69 return (N ULL);68 return (NILLNODE); 70 69 } else { 71 70 return ((LstNode)((List)l)->lastPtr); -
branches/FREEBSD/src/kmk/lst.lib/lstMember.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstMember.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstMember.c,v 1.6 1999/08/28 01:03:55 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstMember.c,v 1.10 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 52 51 Lst_Member (l, d) 53 52 Lst l; 54 void *d;53 ClientData d; 55 54 { 56 55 List list = (List) l; … … 58 57 59 58 lNode = list->firstPtr; 60 if (lNode == N ULL) {61 return N ULL;59 if (lNode == NilListNode) { 60 return NILLNODE; 62 61 } 63 62 … … 67 66 } 68 67 lNode = lNode->nextPtr; 69 } while (lNode != N ULL&& lNode != list->firstPtr);68 } while (lNode != NilListNode && lNode != list->firstPtr); 70 69 71 return N ULL;70 return NILLNODE; 72 71 } -
branches/FREEBSD/src/kmk/lst.lib/lstNext.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstNext.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstNext.c,v 1.6 1999/08/28 01:03:55 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstNext.c,v 1.9 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstNext.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 60 59 * 61 60 * Results: 62 * The next node or N ULLif the list has yet to be opened. Also63 * if the list is non-circular and the end has been reached, N ULL61 * The next node or NILLNODE if the list has yet to be opened. Also 62 * if the list is non-circular and the end has been reached, NILLNODE 64 63 * is returned. 65 64 * … … 78 77 if ((LstValid (l) == FALSE) || 79 78 (list->isOpen == FALSE)) { 80 return (N ULL);79 return (NILLNODE); 81 80 } 82 81 83 82 list->prevPtr = list->curPtr; 84 83 85 if (list->curPtr == N ULL) {84 if (list->curPtr == NilListNode) { 86 85 if (list->atEnd == Unknown) { 87 86 /* … … 93 92 list->atEnd = Middle; 94 93 } else { 95 tln = N ULL;94 tln = NilListNode; 96 95 list->atEnd = Tail; 97 96 } … … 100 99 list->curPtr = tln; 101 100 102 if (tln == list->firstPtr || tln == N ULL) {101 if (tln == list->firstPtr || tln == NilListNode) { 103 102 /* 104 103 * If back at the front, then we've hit the end... -
branches/FREEBSD/src/kmk/lst.lib/lstOpen.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstOpen.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstOpen.c,v 1.5 1999/08/28 01:03:56 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstOpen.c,v 1.8 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstOpen.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 63 62 * 64 63 * Side Effects: 65 * isOpen is set TRUE and curPtr is set to N ULLso the64 * isOpen is set TRUE and curPtr is set to NilListNode so the 66 65 * other sequential functions no it was just opened and can choose 67 66 * the first element accessed based on this. … … 78 77 ((List) l)->isOpen = TRUE; 79 78 ((List) l)->atEnd = LstIsEmpty (l) ? Head : Unknown; 80 ((List) l)->curPtr = N ULL;79 ((List) l)->curPtr = NilListNode; 81 80 82 81 return (SUCCESS); -
branches/FREEBSD/src/kmk/lst.lib/lstRemove.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstRemove.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstRemove.c,v 1.6 1999/08/28 01:03:56 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstRemove.c,v 1.10 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstRemove.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 58 57 * 59 58 * Side Effects: 60 * The list's firstPtr will be set to N ULLif ln is the last59 * The list's firstPtr will be set to NilListNode if ln is the last 61 60 * node on the list. firsPtr and lastPtr will be altered if ln is 62 61 * either the first or last node, respectively, on the list. … … 80 79 * unlink it from the list 81 80 */ 82 if (lNode->nextPtr != N ULL) {81 if (lNode->nextPtr != NilListNode) { 83 82 lNode->nextPtr->prevPtr = lNode->prevPtr; 84 83 } 85 if (lNode->prevPtr != N ULL) {84 if (lNode->prevPtr != NilListNode) { 86 85 lNode->prevPtr->nextPtr = lNode->nextPtr; 87 86 } … … 101 100 * Sequential access stuff. If the node we're removing is the current 102 101 * node in the list, reset the current node to the previous one. If the 103 * previous one was non-existent (prevPtr == N ULL), we set the102 * previous one was non-existent (prevPtr == NilListNode), we set the 104 103 * end to be Unknown, since it is. 105 104 */ 106 105 if (list->isOpen && (list->curPtr == lNode)) { 107 106 list->curPtr = list->prevPtr; 108 if (list->curPtr == N ULL) {107 if (list->curPtr == NilListNode) { 109 108 list->atEnd = Unknown; 110 109 } … … 117 116 */ 118 117 if (list->firstPtr == lNode) { 119 list->firstPtr = N ULL;118 list->firstPtr = NilListNode; 120 119 } 121 120 … … 125 124 */ 126 125 if (lNode->useCount == 0) { 127 free ( ln);126 free ((Address)ln); 128 127 } else { 129 128 lNode->flags |= LN_DELETED; -
branches/FREEBSD/src/kmk/lst.lib/lstReplace.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstReplace.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstReplace.c,v 1.5 1999/08/28 01:03:56 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstReplace.c,v 1.9 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstReplace.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 65 64 Lst_Replace (ln, d) 66 65 register LstNode ln; 67 void *d;66 ClientData d; 68 67 { 69 if (ln == N ULL) {68 if (ln == NILLNODE) { 70 69 return (FAILURE); 71 70 } else { -
branches/FREEBSD/src/kmk/lst.lib/lstSucc.c
r9 r24 34 34 * SUCH DAMAGE. 35 35 * 36 * @(#)lstSucc.c 8.1 (Berkeley) 6/6/9336 * $FreeBSD: src/usr.bin/make/lst.lib/lstSucc.c,v 1.5 1999/08/28 01:03:57 peter Exp $ 37 37 */ 38 38 39 39 #ifndef lint 40 #include <sys/cdefs.h> 41 __FBSDID("$FreeBSD: src/usr.bin/make/lst.lib/lstSucc.c,v 1.8 2002/10/09 02:00:22 jmallett Exp $"); 40 static char sccsid[] = "@(#)lstSucc.c 8.1 (Berkeley) 6/6/93"; 42 41 #endif /* not lint */ 43 42 … … 68 67 LstNode ln; 69 68 { 70 if (ln == N ULL) {71 return (N ULL);69 if (ln == NILLNODE) { 70 return (NILLNODE); 72 71 } else { 73 72 return ((LstNode) ((ListNode) ln)->nextPtr);
Note:
See TracChangeset
for help on using the changeset viewer.

