home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved.
- *
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE
- * SANTA CRUZ OPERATION INC.
- *
- * The copyright notice above does not evidence any actual or intended
- * publication of such source code.
- */
-
- /*
- * Copyrighted as an unpublished work.
- * (c) Copyright 1987-1995 Computer Associates International, Inc.
- * All rights reserved.
- *
- * RESTRICTED RIGHTS
- *
- * These programs are supplied under a license. They may be used,
- * disclosed, and/or copied only as permitted under such license
- * agreement. Any copy must contain the above copyright notice and
- * this restricted rights notice. Use, copying, and/or disclosure
- * of the programs is strictly prohibited unless otherwise provided
- * in the license agreement.
- */
- /*
- * Copyright (c) 1982-1995
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
- #ident "@(#)insrem.h 1.5"
- #ident "$Id$"
-
- /*
- *
- * A list is headed by a single forward pointer (or an array of forward
- * pointers for a hash table header). The elements are doubly linked
- * so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before
- * or after an existing element or at the head of the list. A list
- * may only be traversed in the forward direction.
- *
- */
-
- /*
- * List functions.
- */
- #define LIST_INIT(head) \
- (head)->lh_first = NULL;
-
- #define LIST_INSERT_HEAD(head, elm, field) \
- if (((elm)->field.le_next = (head)->lh_first) != NULL) \
- (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
- (head)->lh_first = (elm); \
- (elm)->field.le_prev = &(head)->lh_first;
-
- #define LIST_REMOVE(elm, field) \
- if ((elm)->field.le_next != NULL) \
- (elm)->field.le_next->field.le_prev = \
- (elm)->field.le_prev; \
- *(elm)->field.le_prev = (elm)->field.le_next; \
- (elm)->field.le_next = NULL; \
- (elm)->field.le_prev = NULL;
-
- typedef struct vq {
- void *fwd;
- void *back;
- } vq_t;
-
- #define DEQUENXT(e) (e)->fwd = ((vq_t *)(e)->fwd)->fwd
-
- #define ENQUE(e, p) (e)->fwd = (p)->fwd; (p)->fwd = (e)
-
- #define INSQUE(e, p) (e)->back = (p); \
- (e)->fwd = ((vq_t *)(p)->fwd); \
- ((vq_t *)(p)->fwd)->back = (e); \
- (p)->fwd = (e);
-
- #define REMQUE(e) ((vq_t *)(e)->back)->fwd = (e)->fwd; \
- ((vq_t *)(e)->fwd)->back = (e)->back; \
- (e)->fwd = NULL; \
- (e)->back = NULL;
-
- /* XXX should go */
- #define insque(a, b) INSQUE(a, b)
- #define remque(a) REMQUE(a)
-