diff options
author | harti <harti@FreeBSD.org> | 2004-11-26 12:17:23 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2004-11-26 12:17:23 +0000 |
commit | 1ce692dc6551a683467623fc437c34f027de50d1 (patch) | |
tree | ab00e91c580c3743e67b1db587afc97f17349ebd /usr.bin/make/lst.lib | |
parent | e257308b07ececec004a50897bcb88d5ae23203e (diff) | |
download | FreeBSD-src-1ce692dc6551a683467623fc437c34f027de50d1.zip FreeBSD-src-1ce692dc6551a683467623fc437c34f027de50d1.tar.gz |
Style: prototypes, un-register and remove some empty lines.
Diffstat (limited to 'usr.bin/make/lst.lib')
25 files changed, 100 insertions, 133 deletions
diff --git a/usr.bin/make/lst.lib/lstAppend.c b/usr.bin/make/lst.lib/lstAppend.c index 8f7b4e0..48093f6 100644 --- a/usr.bin/make/lst.lib/lstAppend.c +++ b/usr.bin/make/lst.lib/lstAppend.c @@ -56,6 +56,11 @@ __FBSDID("$FreeBSD$"); * Results: * SUCCESS if all went well. * + * Arguments: + * l affected list + * ln node after which to append the datum + * d said datum + * * 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 @@ -65,14 +70,11 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ ReturnStatus -Lst_Append (l, ln, d) - Lst l; /* affected list */ - LstNode ln; /* node after which to append the datum */ - void * d; /* said datum */ +Lst_Append (Lst l, LstNode ln, void *d) { - register List list; - register ListNode lNode; - register ListNode nLNode; + List list; + ListNode lNode; + ListNode nLNode; if (LstValid (l) && (ln == NULL && LstIsEmpty (l))) { goto ok; @@ -113,4 +115,3 @@ Lst_Append (l, ln, d) return (SUCCESS); } - diff --git a/usr.bin/make/lst.lib/lstAtEnd.c b/usr.bin/make/lst.lib/lstAtEnd.c index bb13552..9b4c7de 100644 --- a/usr.bin/make/lst.lib/lstAtEnd.c +++ b/usr.bin/make/lst.lib/lstAtEnd.c @@ -56,17 +56,19 @@ __FBSDID("$FreeBSD$"); * Results: * SUCCESS if life is good. * + * Arguments: + * l List to which to add the datum + * d Datum to add + * * Side Effects: * A new ListNode is created and added to the list. * *----------------------------------------------------------------------- */ ReturnStatus -Lst_AtEnd (l, d) - Lst l; /* List to which to add the datum */ - void * d; /* Datum to add */ +Lst_AtEnd(Lst l, void *d) { - register LstNode end; + LstNode end; end = Lst_Last (l); return (Lst_Append (l, end, d)); diff --git a/usr.bin/make/lst.lib/lstAtFront.c b/usr.bin/make/lst.lib/lstAtFront.c index dfce7ca..81a4908 100644 --- a/usr.bin/make/lst.lib/lstAtFront.c +++ b/usr.bin/make/lst.lib/lstAtFront.c @@ -63,11 +63,9 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ ReturnStatus -Lst_AtFront (l, d) - Lst l; - void * d; +Lst_AtFront(Lst l, void *d) { - register LstNode front; + LstNode front; front = Lst_First (l); return (Lst_Insert (l, front, d)); diff --git a/usr.bin/make/lst.lib/lstClose.c b/usr.bin/make/lst.lib/lstClose.c index d76f027..11fb07a 100644 --- a/usr.bin/make/lst.lib/lstClose.c +++ b/usr.bin/make/lst.lib/lstClose.c @@ -61,16 +61,18 @@ __FBSDID("$FreeBSD$"); * Results: * None. * + * Arguments: + * l The list to close + * * Side Effects: * The list is closed. * *----------------------------------------------------------------------- */ void -Lst_Close (l) - Lst l; /* The list to close */ +Lst_Close(Lst l) { - register List list = (List) l; + List list = (List) l; if (LstValid(l) == TRUE) { list->isOpen = FALSE; diff --git a/usr.bin/make/lst.lib/lstConcat.c b/usr.bin/make/lst.lib/lstConcat.c index 83e1931..94590df 100644 --- a/usr.bin/make/lst.lib/lstConcat.c +++ b/usr.bin/make/lst.lib/lstConcat.c @@ -61,23 +61,25 @@ __FBSDID("$FreeBSD$"); * Results: * SUCCESS if all went well. FAILURE otherwise. * + * Arguments: + * l1 The list to which l2 is to be appended + * l2 The list to append to l1 + * flags LST_CONCNEW if LstNode's should be duplicated + * LST_CONCLINK if should just be relinked + * * Side Effects: * New elements are created and appended the the first list. *----------------------------------------------------------------------- */ ReturnStatus -Lst_Concat (l1, l2, flags) - Lst l1; /* The list to which l2 is to be appended */ - Lst l2; /* The list to append to l1 */ - int flags; /* LST_CONCNEW if LstNode's should be duplicated - * LST_CONCLINK if should just be relinked */ +Lst_Concat(Lst l1, Lst l2, int flags) { - register ListNode ln; /* original LstNode */ - register ListNode nln; /* new LstNode */ - register ListNode last; /* the last element in the list. Keeps + ListNode ln; /* original LstNode */ + ListNode nln; /* new LstNode */ + ListNode last; /* the last element in the list. Keeps * bookkeeping until the end */ - register List list1 = (List)l1; - register List list2 = (List)l2; + List list1 = (List)l1; + List list2 = (List)l2; if (!LstValid (l1) || !LstValid (l2)) { return (FAILURE); @@ -176,4 +178,3 @@ Lst_Concat (l1, l2, flags) return (SUCCESS); } - diff --git a/usr.bin/make/lst.lib/lstDatum.c b/usr.bin/make/lst.lib/lstDatum.c index 7151739..4cb6708 100644 --- a/usr.bin/make/lst.lib/lstDatum.c +++ b/usr.bin/make/lst.lib/lstDatum.c @@ -62,13 +62,12 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ void * -Lst_Datum (ln) - LstNode ln; +Lst_Datum(LstNode ln) { + if (ln != NULL) { return (((ListNode)ln)->datum); } else { return ((void *) NULL); } } - diff --git a/usr.bin/make/lst.lib/lstDeQueue.c b/usr.bin/make/lst.lib/lstDeQueue.c index cfcf29c..1bd494e 100644 --- a/usr.bin/make/lst.lib/lstDeQueue.c +++ b/usr.bin/make/lst.lib/lstDeQueue.c @@ -63,11 +63,10 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ void * -Lst_DeQueue (l) - Lst l; +Lst_DeQueue(Lst l) { - void * rd; - register ListNode tln; + void * rd; + ListNode tln; tln = (ListNode) Lst_First (l); if (tln == NULL) { @@ -81,4 +80,3 @@ Lst_DeQueue (l) return (rd); } } - diff --git a/usr.bin/make/lst.lib/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c index 554d976..4e511d2 100644 --- a/usr.bin/make/lst.lib/lstDestroy.c +++ b/usr.bin/make/lst.lib/lstDestroy.c @@ -64,13 +64,11 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ void -Lst_Destroy (l, freeProc) - Lst l; - register void (*freeProc)(void *); +Lst_Destroy(Lst l, void (*freeProc)(void *)) { - register ListNode ln; - register ListNode tln = NULL; - register List list = (List)l; + ListNode ln; + ListNode tln = NULL; + List list = (List)l; if (l == NULL || ! l) { /* diff --git a/usr.bin/make/lst.lib/lstDupl.c b/usr.bin/make/lst.lib/lstDupl.c index b66e6c4..0c3d750 100644 --- a/usr.bin/make/lst.lib/lstDupl.c +++ b/usr.bin/make/lst.lib/lstDupl.c @@ -58,19 +58,20 @@ __FBSDID("$FreeBSD$"); * Results: * The new Lst structure or NULL if failure. * + * Arguments: + * l the list to duplicate + * copyProc A function to duplicate each void + * * Side Effects: * A new list is created. *----------------------------------------------------------------------- */ Lst -Lst_Duplicate (l, copyProc) - Lst l; /* the list to duplicate */ - /* A function to duplicate each void * */ - void * (*copyProc)(void *); +Lst_Duplicate(Lst l, void *(*copyProc)(void *)) { - register Lst nl; - register ListNode ln; - register List list = (List)l; + Lst nl; + ListNode ln; + List list = (List)l; if (!LstValid (l)) { return (NULL); diff --git a/usr.bin/make/lst.lib/lstEnQueue.c b/usr.bin/make/lst.lib/lstEnQueue.c index 8577dbf..de1b533 100644 --- a/usr.bin/make/lst.lib/lstEnQueue.c +++ b/usr.bin/make/lst.lib/lstEnQueue.c @@ -63,14 +63,12 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ ReturnStatus -Lst_EnQueue (l, d) - Lst l; - void * d; +Lst_EnQueue(Lst l, void *d) { + if (LstValid (l) == FALSE) { return (FAILURE); } return (Lst_Append (l, Lst_Last(l), d)); } - diff --git a/usr.bin/make/lst.lib/lstFind.c b/usr.bin/make/lst.lib/lstFind.c index a859a93..8572847 100644 --- a/usr.bin/make/lst.lib/lstFind.c +++ b/usr.bin/make/lst.lib/lstFind.c @@ -63,11 +63,8 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ LstNode -Lst_Find (l, d, cProc) - Lst l; - void * d; - int (*cProc)(void *, void *); +Lst_Find(Lst l, void *d, int (*cProc)(void *, void *)) { + return (Lst_FindFrom (l, Lst_First(l), d, cProc)); } - diff --git a/usr.bin/make/lst.lib/lstFindFrom.c b/usr.bin/make/lst.lib/lstFindFrom.c index 2583c91..cecaef7 100644 --- a/usr.bin/make/lst.lib/lstFindFrom.c +++ b/usr.bin/make/lst.lib/lstFindFrom.c @@ -64,14 +64,10 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ LstNode -Lst_FindFrom (l, ln, d, cProc) - Lst l; - register LstNode ln; - register void * d; - register int (*cProc)(void *, void *); +Lst_FindFrom(Lst l, LstNode ln, void *d, int (*cProc)(void *, void *)) { - register ListNode tln; - Boolean found = FALSE; + ListNode tln; + Boolean found = FALSE; if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) { return (NULL); @@ -94,4 +90,3 @@ Lst_FindFrom (l, ln, d, cProc) return (NULL); } } - diff --git a/usr.bin/make/lst.lib/lstFirst.c b/usr.bin/make/lst.lib/lstFirst.c index 56a602af..daa83fb 100644 --- a/usr.bin/make/lst.lib/lstFirst.c +++ b/usr.bin/make/lst.lib/lstFirst.c @@ -62,13 +62,12 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ LstNode -Lst_First (l) - Lst l; +Lst_First(Lst l) { + if (!LstValid (l) || LstIsEmpty (l)) { return (NULL); } else { return ((LstNode)((List)l)->firstPtr); } } - diff --git a/usr.bin/make/lst.lib/lstForEach.c b/usr.bin/make/lst.lib/lstForEach.c index 2df3f9f..b3a7e66 100644 --- a/usr.bin/make/lst.lib/lstForEach.c +++ b/usr.bin/make/lst.lib/lstForEach.c @@ -63,13 +63,9 @@ __FBSDID("$FreeBSD$"); * *----------------------------------------------------------------------- */ -/*VARARGS2*/ void -Lst_ForEach (l, proc, d) - Lst l; - register int (*proc)(void *, void *); - register void * d; +Lst_ForEach(Lst l, int (*proc)(void *, void *), void *d) { + Lst_ForEachFrom(l, Lst_First(l), proc, d); } - diff --git a/usr.bin/make/lst.lib/lstForEachFrom.c b/usr.bin/make/lst.lib/lstForEachFrom.c index 388692b..12a31b7 100644 --- a/usr.bin/make/lst.lib/lstForEachFrom.c +++ b/usr.bin/make/lst.lib/lstForEachFrom.c @@ -64,19 +64,14 @@ __FBSDID("$FreeBSD$"); * *----------------------------------------------------------------------- */ -/*VARARGS2*/ void -Lst_ForEachFrom (l, ln, proc, d) - Lst l; - LstNode ln; - register int (*proc)(void *, void *); - register void * d; +Lst_ForEachFrom(Lst l, LstNode ln, int (*proc)(void *, void *), void *d) { - register ListNode tln = (ListNode)ln; - register List list = (List)l; - register ListNode next; - Boolean done; - int result; + ListNode tln = (ListNode)ln; + List list = (List)l; + ListNode next; + Boolean done; + int result; if (!LstValid (list) || LstIsEmpty (list)) { return; @@ -110,6 +105,4 @@ Lst_ForEachFrom (l, ln, proc, d) } tln = next; } while (!result && !LstIsEmpty(list) && !done); - } - diff --git a/usr.bin/make/lst.lib/lstInit.c b/usr.bin/make/lst.lib/lstInit.c index 03e7c4d..da6b7b9 100644 --- a/usr.bin/make/lst.lib/lstInit.c +++ b/usr.bin/make/lst.lib/lstInit.c @@ -56,16 +56,18 @@ __FBSDID("$FreeBSD$"); * Results: * The created list. * + * Arguments: + * circ TRUE if the list should be made circular + * * Side Effects: * A list is created, what else? * *----------------------------------------------------------------------- */ Lst -Lst_Init(circ) - Boolean circ; /* TRUE if the list should be made circular */ +Lst_Init(Boolean circ) { - register List nList; + List nList; PAlloc (nList, List); diff --git a/usr.bin/make/lst.lib/lstInsert.c b/usr.bin/make/lst.lib/lstInsert.c index aaa9077..99fe138 100644 --- a/usr.bin/make/lst.lib/lstInsert.c +++ b/usr.bin/make/lst.lib/lstInsert.c @@ -57,6 +57,10 @@ __FBSDID("$FreeBSD$"); * Results: * SUCCESS or FAILURE. * + * l list to manipulate + * ln node before which to insert d + * d datum to be inserted + * * Side Effects: * the firstPtr field will be changed if ln is the first node in the * list. @@ -64,15 +68,11 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ ReturnStatus -Lst_Insert (l, ln, d) - Lst l; /* list to manipulate */ - LstNode ln; /* node before which to insert d */ - void * d; /* datum to be inserted */ +Lst_Insert(Lst l, LstNode ln, void *d) { - register ListNode nLNode; /* new lnode for d */ - register ListNode lNode = (ListNode)ln; - register List list = (List)l; - + ListNode nLNode; /* new lnode for d */ + ListNode lNode = (ListNode)ln; + List list = (List)l; /* * check validity of arguments @@ -113,4 +113,3 @@ Lst_Insert (l, ln, d) return (SUCCESS); } - diff --git a/usr.bin/make/lst.lib/lstIsAtEnd.c b/usr.bin/make/lst.lib/lstIsAtEnd.c index 8927408..34d97d0 100644 --- a/usr.bin/make/lst.lib/lstIsAtEnd.c +++ b/usr.bin/make/lst.lib/lstIsAtEnd.c @@ -73,12 +73,10 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ Boolean -Lst_IsAtEnd (l) - Lst l; +Lst_IsAtEnd(Lst l) { - register List list = (List) l; + List list = (List) l; return (!LstValid (l) || !list->isOpen || (list->atEnd == Head) || (list->atEnd == Tail)); } - diff --git a/usr.bin/make/lst.lib/lstIsEmpty.c b/usr.bin/make/lst.lib/lstIsEmpty.c index 6c76188..06a3661 100644 --- a/usr.bin/make/lst.lib/lstIsEmpty.c +++ b/usr.bin/make/lst.lib/lstIsEmpty.c @@ -64,9 +64,8 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ Boolean -Lst_IsEmpty (l) - Lst l; +Lst_IsEmpty(Lst l) { + return ( ! LstValid (l) || LstIsEmpty(l)); } - diff --git a/usr.bin/make/lst.lib/lstMember.c b/usr.bin/make/lst.lib/lstMember.c index c856458..fdf3224 100644 --- a/usr.bin/make/lst.lib/lstMember.c +++ b/usr.bin/make/lst.lib/lstMember.c @@ -49,12 +49,10 @@ __FBSDID("$FreeBSD$"); #include "lstInt.h" LstNode -Lst_Member (l, d) - Lst l; - void * d; +Lst_Member(Lst l, void *d) { - List list = (List) l; - register ListNode lNode; + List list = (List) l; + ListNode lNode; lNode = list->firstPtr; if (lNode == NULL) { diff --git a/usr.bin/make/lst.lib/lstNext.c b/usr.bin/make/lst.lib/lstNext.c index f2d2066..1f31e61 100644 --- a/usr.bin/make/lst.lib/lstNext.c +++ b/usr.bin/make/lst.lib/lstNext.c @@ -69,11 +69,10 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ LstNode -Lst_Next (l) - Lst l; +Lst_Next(Lst l) { - register ListNode tln; - register List list = (List)l; + ListNode tln; + List list = (List)l; if ((LstValid (l) == FALSE) || (list->isOpen == FALSE)) { @@ -114,4 +113,3 @@ Lst_Next (l) return ((LstNode)tln); } - diff --git a/usr.bin/make/lst.lib/lstOpen.c b/usr.bin/make/lst.lib/lstOpen.c index 8e0b087..a35f714 100644 --- a/usr.bin/make/lst.lib/lstOpen.c +++ b/usr.bin/make/lst.lib/lstOpen.c @@ -69,9 +69,9 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ ReturnStatus -Lst_Open (l) - register Lst l; +Lst_Open(Lst l) { + if (LstValid (l) == FALSE) { return (FAILURE); } @@ -81,4 +81,3 @@ Lst_Open (l) return (SUCCESS); } - diff --git a/usr.bin/make/lst.lib/lstRemove.c b/usr.bin/make/lst.lib/lstRemove.c index a90807b..a37cedd 100644 --- a/usr.bin/make/lst.lib/lstRemove.c +++ b/usr.bin/make/lst.lib/lstRemove.c @@ -64,12 +64,10 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ ReturnStatus -Lst_Remove (l, ln) - Lst l; - LstNode ln; +Lst_Remove(Lst l, LstNode ln) { - register List list = (List) l; - register ListNode lNode = (ListNode) ln; + List list = (List) l; + ListNode lNode = (ListNode) ln; if (!LstValid (l) || !LstNodeValid (ln, l)) { diff --git a/usr.bin/make/lst.lib/lstReplace.c b/usr.bin/make/lst.lib/lstReplace.c index c71f967..c41dea1 100644 --- a/usr.bin/make/lst.lib/lstReplace.c +++ b/usr.bin/make/lst.lib/lstReplace.c @@ -62,10 +62,9 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ ReturnStatus -Lst_Replace (ln, d) - register LstNode ln; - void * d; +Lst_Replace(LstNode ln, void *d) { + if (ln == NULL) { return (FAILURE); } else { diff --git a/usr.bin/make/lst.lib/lstSucc.c b/usr.bin/make/lst.lib/lstSucc.c index c4cfcf6..ff1dd68 100644 --- a/usr.bin/make/lst.lib/lstSucc.c +++ b/usr.bin/make/lst.lib/lstSucc.c @@ -64,13 +64,12 @@ __FBSDID("$FreeBSD$"); *----------------------------------------------------------------------- */ LstNode -Lst_Succ (ln) - LstNode ln; +Lst_Succ(LstNode ln) { + if (ln == NULL) { return (NULL); } else { return ((LstNode) ((ListNode) ln)->nextPtr); } } - |