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

Import of RELENG_4_7_0_RELEASE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.