VirtualBox

Changeset 24 in kBuild for branches/FREEBSD/src/kmk/lst.lib


Ignore:
Timestamp:
Nov 26, 2002 9:24:54 PM (22 years ago)
Author:
bird
Message:

Import of RELENG_4_7_0_RELEASE

Location:
branches/FREEBSD/src/kmk/lst.lib
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • branches/FREEBSD/src/kmk/lst.lib/lstAppend.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstAppend.c      8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstAppend.c,v 1.6 1999/08/28 01:03:45 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstAppend.c 8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6160 *      field of the List will be altered if ln is the last node in the
    6261 *      list. lastPtr and firstPtr will alter if the list was empty and
    63  *      ln was NULL.
     62 *      ln was NILLNODE.
    6463 *
    6564 *-----------------------------------------------------------------------
     
    6968    Lst         l;      /* affected list */
    7069    LstNode     ln;     /* node after which to append the datum */
    71     void *      d;      /* said datum */
     70    ClientData  d;      /* said datum */
    7271{
    7372    register List       list;
     
    7574    register ListNode   nLNode;
    7675
    77     if (LstValid (l) && (ln == NULL && LstIsEmpty (l))) {
     76    if (LstValid (l) && (ln == NILLNODE && LstIsEmpty (l))) {
    7877        goto ok;
    7978    }
     
    9190    nLNode->useCount = nLNode->flags = 0;
    9291
    93     if (lNode == NULL) {
     92    if (lNode == NilListNode) {
    9493        if (list->isCirc) {
    9594            nLNode->nextPtr = nLNode->prevPtr = nLNode;
    9695        } else {
    97             nLNode->nextPtr = nLNode->prevPtr = NULL;
     96            nLNode->nextPtr = nLNode->prevPtr = NilListNode;
    9897        }
    9998        list->firstPtr = list->lastPtr = nLNode;
     
    103102
    104103        lNode->nextPtr = nLNode;
    105         if (nLNode->nextPtr != NULL) {
     104        if (nLNode->nextPtr != NilListNode) {
    106105            nLNode->nextPtr->prevPtr = nLNode;
    107106        }
  • branches/FREEBSD/src/kmk/lst.lib/lstAtEnd.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstAtEnd.c       8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstAtEnd.c,v 1.6 1999/08/28 01:03:46 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstAtEnd.c  8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6564Lst_AtEnd (l, d)
    6665    Lst         l;      /* List to which to add the datum */
    67     void *      d;      /* Datum to add */
     66    ClientData  d;      /* Datum to add */
    6867{
    6968    register LstNode    end;
  • branches/FREEBSD/src/kmk/lst.lib/lstAtFront.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstAtFront.c     8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstAtFront.c,v 1.6 1999/08/28 01:03:47 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstAtFront.c        8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6665Lst_AtFront (l, d)
    6766    Lst         l;
    68     void *      d;
     67    ClientData  d;
    6968{
    7069    register LstNode    front;
  • branches/FREEBSD/src/kmk/lst.lib/lstClose.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstClose.c       8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstClose.c,v 1.6 1999/08/28 01:03:47 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstClose.c  8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
  • branches/FREEBSD/src/kmk/lst.lib/lstConcat.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstConcat.c      8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstConcat.c,v 1.7 1999/08/28 01:03:47 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstConcat.c 8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    8584
    8685    if (flags == LST_CONCLINK) {
    87         if (list2->firstPtr != NULL) {
     86        if (list2->firstPtr != NilListNode) {
    8887            /*
    8988             * We set the nextPtr of the
    90              * last element of list two to be NULL to make the loop easier and
     89             * last element of list two to be NIL to make the loop easier and
    9190             * so we don't need an extra case should the first list turn
    9291             * out to be non-circular -- the final element will already point
    93              * to NULL space and the first element will be untouched if it
    94              * existed before and will also point to NULL 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.
    9594             */
    96             list2->lastPtr->nextPtr = NULL;
     95            list2->lastPtr->nextPtr = NilListNode;
    9796            /*
    9897             * So long as the second list isn't empty, we just link the
     
    104103             */
    105104            list2->firstPtr->prevPtr = list1->lastPtr;
    106             if (list1->lastPtr != NULL) {
     105            if (list1->lastPtr != NilListNode) {
    107106                list1->lastPtr->nextPtr = list2->firstPtr;
    108107            } else {
     
    111110            list1->lastPtr = list2->lastPtr;
    112111        }
    113         if (list1->isCirc && list1->firstPtr != NULL) {
     112        if (list1->isCirc && list1->firstPtr != NilListNode) {
    114113            /*
    115114             * If the first list is supposed to be circular and it is (now)
     
    120119            list1->lastPtr->nextPtr = list1->firstPtr;
    121120        }
    122         free (l2);
    123     } else if (list2->firstPtr != NULL) {
     121        free ((Address)l2);
     122    } else if (list2->firstPtr != NilListNode) {
    124123        /*
    125          * We set the nextPtr of the last element of list 2 to be NULL to make
     124         * We set the nextPtr of the last element of list 2 to be nil to make
    126125         * the loop less difficult. The loop simply goes through the entire
    127126         * second list creating new LstNodes and filling in the nextPtr, and
     
    130129         * follows the last of the new nodes along until the entire l2 has
    131130         * 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,
    133132         * the first list must have been empty so the newly-created node is
    134133         * made the first node of the list.
    135134         */
    136         list2->lastPtr->nextPtr = NULL;
     135        list2->lastPtr->nextPtr = NilListNode;
    137136        for (last = list1->lastPtr, ln = list2->firstPtr;
    138              ln != NULL;
     137             ln != NilListNode;
    139138             ln = ln->nextPtr)
    140139        {
    141140            PAlloc (nln, ListNode);
    142141            nln->datum = ln->datum;
    143             if (last != NULL) {
     142            if (last != NilListNode) {
    144143                last->nextPtr = nln;
    145144            } else {
     
    167166            list1->firstPtr->prevPtr = list1->lastPtr;
    168167        } else {
    169             last->nextPtr = NULL;
     168            last->nextPtr = NilListNode;
    170169        }
    171170
  • branches/FREEBSD/src/kmk/lst.lib/lstDatum.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstDatum.c       8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstDatum.c,v 1.5 1999/08/28 01:03:48 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstDatum.c  8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5554 *
    5655 * Results:
    57  *      The datum or (ick!) NULL if the node is invalid.
     56 *      The datum or (ick!) NIL if the node is invalid.
    5857 *
    5958 * Side Effects:
     
    6261 *-----------------------------------------------------------------------
    6362 */
    64 void *
     63ClientData
    6564Lst_Datum (ln)
    6665    LstNode     ln;
    6766{
    68     if (ln != NULL) {
     67    if (ln != NILLNODE) {
    6968        return (((ListNode)ln)->datum);
    7069    } else {
    71         return ((void *) NULL);
     70        return ((ClientData) NIL);
    7271    }
    7372}
  • branches/FREEBSD/src/kmk/lst.lib/lstDeQueue.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstDeQueue.c     8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstDeQueue.c,v 1.6 1999/08/28 01:03:48 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstDeQueue.c        8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5554 *
    5655 * Results:
    57  *      The datum in the node at the head or (ick) NULL if the list
     56 *      The datum in the node at the head or (ick) NIL if the list
    5857 *      is empty.
    5958 *
     
    6362 *-----------------------------------------------------------------------
    6463 */
    65 void *
     64ClientData
    6665Lst_DeQueue (l)
    6766    Lst           l;
    6867{
    69     void *        rd;
     68    ClientData    rd;
    7069    register ListNode   tln;
    7170
    7271    tln = (ListNode) Lst_First (l);
    73     if (tln == NULL) {
    74         return ((void *) NULL);
     72    if (tln == NilListNode) {
     73        return ((ClientData) NIL);
    7574    }
    7675
    7776    rd = tln->datum;
    7877    if (Lst_Remove (l, (LstNode)tln) == FAILURE) {
    79         return ((void *) NULL);
     78        return ((ClientData) NIL);
    8079    } else {
    8180        return (rd);
  • branches/FREEBSD/src/kmk/lst.lib/lstDestroy.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstDestroy.c     8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstDestroy.c,v 1.7 1999/08/28 01:03:49 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstDestroy.c        8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6766Lst_Destroy (l, freeProc)
    6867    Lst                 l;
    69     register void       (*freeProc)(void *);
     68    register void       (*freeProc) __P((ClientData));
    7069{
    7170    register ListNode   ln;
    72     register ListNode   tln = NULL;
     71    register ListNode   tln = NilListNode;
    7372    register List       list = (List)l;
    7473
    75     if (l == NULL || ! l) {
     74    if (l == NILLST || ! l) {
    7675        /*
    7776         * Note the check for l == (Lst)0 to catch uninitialized static Lst's.
     
    8281
    8382    /* To ease scanning */
    84     if (list->lastPtr != NULL)
    85         list->lastPtr->nextPtr = NULL;
     83    if (list->lastPtr != NilListNode)
     84        list->lastPtr->nextPtr = NilListNode;
    8685    else {
    87         free (l);
     86        free ((Address)l);
    8887        return;
    8988    }
    9089
    9190    if (freeProc) {
    92         for (ln = list->firstPtr; ln != NULL; ln = tln) {
     91        for (ln = list->firstPtr; ln != NilListNode; ln = tln) {
    9392             tln = ln->nextPtr;
    9493             (*freeProc) (ln->datum);
    95              free (ln);
     94             free ((Address)ln);
    9695        }
    9796    } else {
    98         for (ln = list->firstPtr; ln != NULL; ln = tln) {
     97        for (ln = list->firstPtr; ln != NilListNode; ln = tln) {
    9998             tln = ln->nextPtr;
    100              free (ln);
     99             free ((Address)ln);
    101100        }
    102101    }
    103102
    104     free (l);
     103    free ((Address)l);
    105104}
  • branches/FREEBSD/src/kmk/lst.lib/lstDupl.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstDupl.c        8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstDupl.c,v 1.7 1999/08/28 01:03:49 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstDupl.c   8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5352 *-----------------------------------------------------------------------
    5453 * Lst_Duplicate --
    55  *      Duplicate an entire list. If a function to copy a void * is
     54 *      Duplicate an entire list. If a function to copy a ClientData is
    5655 *      given, the individual client elements will be duplicated as well.
    5756 *
    5857 * Results:
    59  *      The new Lst structure or NULL if failure.
     58 *      The new Lst structure or NILLST if failure.
    6059 *
    6160 * Side Effects:
     
    6665Lst_Duplicate (l, copyProc)
    6766    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));
    7069{
    7170    register Lst        nl;
     
    7473
    7574    if (!LstValid (l)) {
    76         return (NULL);
     75        return (NILLST);
    7776    }
    7877
    7978    nl = Lst_Init (list->isCirc);
    80     if (nl == NULL) {
    81         return (NULL);
     79    if (nl == NILLST) {
     80        return (NILLST);
    8281    }
    8382
    8483    ln = list->firstPtr;
    85     while (ln != NULL) {
     84    while (ln != NilListNode) {
    8685        if (copyProc != NOCOPY) {
    8786            if (Lst_AtEnd (nl, (*copyProc) (ln->datum)) == FAILURE) {
    88                 return (NULL);
     87                return (NILLST);
    8988            }
    9089        } else if (Lst_AtEnd (nl, ln->datum) == FAILURE) {
    91             return (NULL);
     90            return (NILLST);
    9291        }
    9392
    9493        if (list->isCirc && ln == list->lastPtr) {
    95             ln = NULL;
     94            ln = NilListNode;
    9695        } else {
    9796            ln = ln->nextPtr;
  • branches/FREEBSD/src/kmk/lst.lib/lstEnQueue.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstEnQueue.c     8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstEnQueue.c,v 1.6 1999/08/28 01:03:50 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstEnQueue.c        8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6665Lst_EnQueue (l, d)
    6766    Lst           l;
    68     void *        d;
     67    ClientData    d;
    6968{
    7069    if (LstValid (l) == FALSE) {
  • branches/FREEBSD/src/kmk/lst.lib/lstFind.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstFind.c        8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstFind.c,v 1.6 1999/08/28 01:03:50 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstFind.c   8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5655 *
    5756 * Results:
    58  *      The found node or NULL if none matches.
     57 *      The found node or NILLNODE if none matches.
    5958 *
    6059 * Side Effects:
     
    6665Lst_Find (l, d, cProc)
    6766    Lst         l;
    68     void *      d;
    69     int         (*cProc)(void *, void *);
     67    ClientData  d;
     68    int         (*cProc) __P((ClientData, ClientData));
    7069{
    7170    return (Lst_FindFrom (l, Lst_First(l), d, cProc));
  • branches/FREEBSD/src/kmk/lst.lib/lstFindFrom.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstFindFrom.c    8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstFindFrom.c,v 1.7 1999/08/28 01:03:50 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstFindFrom.c       8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5756 *
    5857 * Results:
    59  *      The found node or NULL
     58 *      The found node or NILLNODE
    6059 *
    6160 * Side Effects:
     
    6867    Lst                 l;
    6968    register LstNode    ln;
    70     register void * d;
    71     register int        (*cProc)(void *, void *);
     69    register ClientData d;
     70    register int        (*cProc) __P((ClientData, ClientData));
    7271{
    7372    register ListNode   tln;
     
    7574
    7675    if (!LstValid (l) || LstIsEmpty (l) || !LstNodeValid (ln, l)) {
    77         return (NULL);
     76        return (NILLNODE);
    7877    }
    7978
     
    8786            tln = tln->nextPtr;
    8887        }
    89     } while (tln != (ListNode)ln && tln != NULL);
     88    } while (tln != (ListNode)ln && tln != NilListNode);
    9089
    9190    if (found) {
    9291        return ((LstNode)tln);
    9392    } else {
    94         return (NULL);
     93        return (NILLNODE);
    9594    }
    9695}
  • branches/FREEBSD/src/kmk/lst.lib/lstFirst.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstFirst.c       8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstFirst.c,v 1.5 1999/08/28 01:03:51 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstFirst.c  8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5554 *
    5655 * Results:
    57  *      The first node or NULL if the list is empty.
     56 *      The first node or NILLNODE if the list is empty.
    5857 *
    5958 * Side Effects:
     
    6766{
    6867    if (!LstValid (l) || LstIsEmpty (l)) {
    69         return (NULL);
     68        return (NILLNODE);
    7069    } else {
    7170        return ((LstNode)((List)l)->firstPtr);
  • branches/FREEBSD/src/kmk/lst.lib/lstForEach.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstForEach.c     8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstForEach.c,v 1.6 1999/08/28 01:03:51 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstForEach.c        8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6867Lst_ForEach (l, proc, d)
    6968    Lst                 l;
    70     register int        (*proc)(void *, void *);
    71     register void *     d;
     69    register int        (*proc) __P((ClientData, ClientData));
     70    register ClientData d;
    7271{
    7372    Lst_ForEachFrom(l, Lst_First(l), proc, d);
  • branches/FREEBSD/src/kmk/lst.lib/lstForEachFrom.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstForEachFrom.c 8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstForEachFrom.c,v 1.7 1999/08/28 01:03:52 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstForEachFrom.c    8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    7069    Lst                 l;
    7170    LstNode             ln;
    72     register int        (*proc)(void *, void *);
    73     register void *     d;
     71    register int        (*proc) __P((ClientData, ClientData));
     72    register ClientData d;
    7473{
    7574    register ListNode   tln = (ListNode)ln;
     
    102101         */
    103102        done = (next == tln->nextPtr &&
    104                 (next == NULL || next == list->firstPtr));
     103                (next == NilListNode || next == list->firstPtr));
    105104
    106105        next = tln->nextPtr;
  • branches/FREEBSD/src/kmk/lst.lib/lstInit.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstInit.c        8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstInit.c,v 1.6 1999/08/28 01:03:52 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstInit.c   8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    7069    PAlloc (nList, List);
    7170
    72     nList->firstPtr = NULL;
    73     nList->lastPtr = NULL;
     71    nList->firstPtr = NilListNode;
     72    nList->lastPtr = NilListNode;
    7473    nList->isOpen = FALSE;
    7574    nList->isCirc = circ;
  • branches/FREEBSD/src/kmk/lst.lib/lstInsert.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstInsert.c      8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstInsert.c,v 1.6 1999/08/28 01:03:52 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstInsert.c 8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6867    Lst                 l;      /* list to manipulate */
    6968    LstNode             ln;     /* node before which to insert d */
    70     void *              d;      /* datum to be inserted */
     69    ClientData          d;      /* datum to be inserted */
    7170{
    7271    register ListNode   nLNode; /* new lnode for d */
     
    7877     * check validity of arguments
    7978     */
    80     if (LstValid (l) && (LstIsEmpty (l) && ln == NULL))
     79    if (LstValid (l) && (LstIsEmpty (l) && ln == NILLNODE))
    8180        goto ok;
    8281
     
    9190    nLNode->useCount = nLNode->flags = 0;
    9291
    93     if (ln == NULL) {
     92    if (ln == NILLNODE) {
    9493        if (list->isCirc) {
    9594            nLNode->prevPtr = nLNode->nextPtr = nLNode;
    9695        } else {
    97             nLNode->prevPtr = nLNode->nextPtr = NULL;
     96            nLNode->prevPtr = nLNode->nextPtr = NilListNode;
    9897        }
    9998        list->firstPtr = list->lastPtr = nLNode;
     
    102101        nLNode->nextPtr = lNode;
    103102
    104         if (nLNode->prevPtr != NULL) {
     103        if (nLNode->prevPtr != NilListNode) {
    105104            nLNode->prevPtr->nextPtr = nLNode;
    106105        }
  • branches/FREEBSD/src/kmk/lst.lib/lstInt.h

    r9 r24  
    3535 *
    3636 *      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 jmallett Exp $
     37 * $FreeBSD: src/usr.bin/make/lst.lib/lstInt.h,v 1.7 1999/08/28 01:03:53 peter Exp $
    3838 */
    3939
     
    5151        struct ListNode *prevPtr;   /* previous element in list */
    5252        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.
    5454                                     * node may not be deleted until count
    5555                                     * goes to 0 */
    5656                        flags:8;    /* Node status flags */
    57         void *  datum;      /* datum associated with this element */
     57        ClientData      datum;      /* datum associated with this element */
    5858} *ListNode;
    5959/*
     
    6161 */
    6262#define LN_DELETED      0x0001      /* List node should be removed when done */
     63
     64#define NilListNode     ((ListNode)-1)
    6365
    6466typedef enum {
     
    7678        Where           atEnd;    /* Where in the list the last access was */
    7779        Boolean         isOpen;   /* true if list has been Lst_Open'ed */
    78         ListNode        curPtr;   /* current node, if open. NULL if
     80        ListNode        curPtr;   /* current node, if open. NilListNode if
    7981                                   * *just* opened */
    8082        ListNode        prevPtr;  /* Previous node, if open. Used by
    8183                                   * Lst_Remove */
    8284} *List;
     85
     86#define NilList         ((List)-1)
    8387
    8488/*
     
    9296 *      Return TRUE if the list l is valid
    9397 */
    94 #define LstValid(l)     (((Lst)l == NULL) ? FALSE : TRUE)
     98#define LstValid(l)     (((Lst)l == NILLST) ? FALSE : TRUE)
    9599
    96100/*
     
    98102 *      Return TRUE if the LstNode ln is valid with respect to l
    99103 */
    100 #define LstNodeValid(ln, l)     ((((LstNode)ln) == NULL) ? FALSE : TRUE)
     104#define LstNodeValid(ln, l)     ((((LstNode)ln) == NILLNODE) ? FALSE : TRUE)
    101105
    102106/*
     
    104108 *      TRUE if the list l is empty.
    105109 */
    106 #define LstIsEmpty(l)   (((List)l)->firstPtr == NULL)
     110#define LstIsEmpty(l)   (((List)l)->firstPtr == NilListNode)
    107111
    108112#endif /* _LSTINT_H_ */
  • branches/FREEBSD/src/kmk/lst.lib/lstIsAtEnd.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstIsAtEnd.c     8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstIsAtEnd.c,v 1.5 1999/08/28 01:03:53 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstIsAtEnd.c        8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
  • branches/FREEBSD/src/kmk/lst.lib/lstIsEmpty.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstIsEmpty.c     8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstIsEmpty.c,v 1.5 1999/08/28 01:03:54 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstIsEmpty.c        8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6059 *      None.
    6160 *
    62  *      A list is considered empty if its firstPtr == NULL (or if
    63  *      the list itself is NULLLIST).
     61 *      A list is considered empty if its firstPtr == NilListNode (or if
     62 *      the list itself is NILLIST).
    6463 *-----------------------------------------------------------------------
    6564 */
  • branches/FREEBSD/src/kmk/lst.lib/lstLast.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstLast.c        8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstLast.c,v 1.5 1999/08/28 01:03:55 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstLast.c   8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5554 *
    5655 * Results:
    57  *      The requested node or NULL if the list is empty.
     56 *      The requested node or NILLNODE if the list is empty.
    5857 *
    5958 * Side Effects:
     
    6766{
    6867    if (!LstValid(l) || LstIsEmpty (l)) {
    69         return (NULL);
     68        return (NILLNODE);
    7069    } else {
    7170        return ((LstNode)((List)l)->lastPtr);
  • branches/FREEBSD/src/kmk/lst.lib/lstMember.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstMember.c      8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstMember.c,v 1.6 1999/08/28 01:03:55 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstMember.c 8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5251Lst_Member (l, d)
    5352    Lst                 l;
    54     void *              d;
     53    ClientData          d;
    5554{
    5655    List                list = (List) l;
     
    5857
    5958    lNode = list->firstPtr;
    60     if (lNode == NULL) {
    61         return NULL;
     59    if (lNode == NilListNode) {
     60        return NILLNODE;
    6261    }
    6362
     
    6766        }
    6867        lNode = lNode->nextPtr;
    69     } while (lNode != NULL && lNode != list->firstPtr);
     68    } while (lNode != NilListNode && lNode != list->firstPtr);
    7069
    71     return NULL;
     70    return NILLNODE;
    7271}
  • branches/FREEBSD/src/kmk/lst.lib/lstNext.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstNext.c        8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstNext.c,v 1.6 1999/08/28 01:03:55 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstNext.c   8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6059 *
    6160 * Results:
    62  *      The next node or NULL if the list has yet to be opened. Also
    63  *      if the list is non-circular and the end has been reached, NULL
     61 *      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
    6463 *      is returned.
    6564 *
     
    7877    if ((LstValid (l) == FALSE) ||
    7978        (list->isOpen == FALSE)) {
    80             return (NULL);
     79            return (NILLNODE);
    8180    }
    8281
    8382    list->prevPtr = list->curPtr;
    8483
    85     if (list->curPtr == NULL) {
     84    if (list->curPtr == NilListNode) {
    8685        if (list->atEnd == Unknown) {
    8786            /*
     
    9392            list->atEnd = Middle;
    9493        } else {
    95             tln = NULL;
     94            tln = NilListNode;
    9695            list->atEnd = Tail;
    9796        }
     
    10099        list->curPtr = tln;
    101100
    102         if (tln == list->firstPtr || tln == NULL) {
     101        if (tln == list->firstPtr || tln == NilListNode) {
    103102            /*
    104103             * If back at the front, then we've hit the end...
  • branches/FREEBSD/src/kmk/lst.lib/lstOpen.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstOpen.c        8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstOpen.c,v 1.5 1999/08/28 01:03:56 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstOpen.c   8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6362 *
    6463 * Side Effects:
    65  *      isOpen is set TRUE and curPtr is set to NULL so the
     64 *      isOpen is set TRUE and curPtr is set to NilListNode so the
    6665 *      other sequential functions no it was just opened and can choose
    6766 *      the first element accessed based on this.
     
    7877        ((List) l)->isOpen = TRUE;
    7978        ((List) l)->atEnd = LstIsEmpty (l) ? Head : Unknown;
    80         ((List) l)->curPtr = NULL;
     79        ((List) l)->curPtr = NilListNode;
    8180
    8281        return (SUCCESS);
  • branches/FREEBSD/src/kmk/lst.lib/lstRemove.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstRemove.c      8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstRemove.c,v 1.6 1999/08/28 01:03:56 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstRemove.c 8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    5857 *
    5958 * Side Effects:
    60  *      The list's firstPtr will be set to NULL if ln is the last
     59 *      The list's firstPtr will be set to NilListNode if ln is the last
    6160 *      node on the list. firsPtr and lastPtr will be altered if ln is
    6261 *      either the first or last node, respectively, on the list.
     
    8079     * unlink it from the list
    8180     */
    82     if (lNode->nextPtr != NULL) {
     81    if (lNode->nextPtr != NilListNode) {
    8382        lNode->nextPtr->prevPtr = lNode->prevPtr;
    8483    }
    85     if (lNode->prevPtr != NULL) {
     84    if (lNode->prevPtr != NilListNode) {
    8685        lNode->prevPtr->nextPtr = lNode->nextPtr;
    8786    }
     
    101100     * Sequential access stuff. If the node we're removing is the current
    102101     * node in the list, reset the current node to the previous one. If the
    103      * previous one was non-existent (prevPtr == NULL), we set the
     102     * previous one was non-existent (prevPtr == NilListNode), we set the
    104103     * end to be Unknown, since it is.
    105104     */
    106105    if (list->isOpen && (list->curPtr == lNode)) {
    107106        list->curPtr = list->prevPtr;
    108         if (list->curPtr == NULL) {
     107        if (list->curPtr == NilListNode) {
    109108            list->atEnd = Unknown;
    110109        }
     
    117116     */
    118117    if (list->firstPtr == lNode) {
    119         list->firstPtr = NULL;
     118        list->firstPtr = NilListNode;
    120119    }
    121120
     
    125124     */
    126125    if (lNode->useCount == 0) {
    127         free (ln);
     126        free ((Address)ln);
    128127    } else {
    129128        lNode->flags |= LN_DELETED;
  • branches/FREEBSD/src/kmk/lst.lib/lstReplace.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstReplace.c     8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstReplace.c,v 1.5 1999/08/28 01:03:56 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstReplace.c        8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6564Lst_Replace (ln, d)
    6665    register LstNode    ln;
    67     void *              d;
     66    ClientData          d;
    6867{
    69     if (ln == NULL) {
     68    if (ln == NILLNODE) {
    7069        return (FAILURE);
    7170    } else {
  • branches/FREEBSD/src/kmk/lst.lib/lstSucc.c

    r9 r24  
    3434 * SUCH DAMAGE.
    3535 *
    36  * @(#)lstSucc.c        8.1 (Berkeley) 6/6/93
     36 * $FreeBSD: src/usr.bin/make/lst.lib/lstSucc.c,v 1.5 1999/08/28 01:03:57 peter Exp $
    3737 */
    3838
    3939#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 $");
     40static char sccsid[] = "@(#)lstSucc.c   8.1 (Berkeley) 6/6/93";
    4241#endif /* not lint */
    4342
     
    6867    LstNode     ln;
    6968{
    70     if (ln == NULL) {
    71         return (NULL);
     69    if (ln == NILLNODE) {
     70        return (NILLNODE);
    7271    } else {
    7372        return ((LstNode) ((ListNode) ln)->nextPtr);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette