Home | History | Annotate | Line # | Download | only in stdlib
remque.c revision 1.2.2.2
      1  1.2.2.2  tron /*
      2  1.2.2.2  tron  *  Copyright (c) 1993 John Brezak
      3  1.2.2.2  tron  *  All rights reserved.
      4  1.2.2.2  tron  *
      5  1.2.2.2  tron  *  Redistribution and use in source and binary forms, with or without
      6  1.2.2.2  tron  *  modification, are permitted provided that the following conditions
      7  1.2.2.2  tron  *  are met:
      8  1.2.2.2  tron  *  1. Redistributions of source code must retain the above copyright
      9  1.2.2.2  tron  *     notice, this list of conditions and the following disclaimer.
     10  1.2.2.2  tron  *  2. Redistributions in binary form must reproduce the above copyright
     11  1.2.2.2  tron  *     notice, this list of conditions and the following disclaimer in the
     12  1.2.2.2  tron  *     documentation and/or other materials provided with the distribution.
     13  1.2.2.2  tron  *  3. The name of the author may be used to endorse or promote products
     14  1.2.2.2  tron  *     derived from this software without specific prior written permission.
     15  1.2.2.2  tron  *
     16  1.2.2.2  tron  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
     17  1.2.2.2  tron  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     18  1.2.2.2  tron  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     19  1.2.2.2  tron  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     20  1.2.2.2  tron  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  1.2.2.2  tron  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     22  1.2.2.2  tron  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.2.2.2  tron  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     24  1.2.2.2  tron  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     25  1.2.2.2  tron  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.2.2.2  tron  * POSSIBILITY OF SUCH DAMAGE.
     27  1.2.2.2  tron  */
     28  1.2.2.2  tron 
     29  1.2.2.2  tron #include <sys/cdefs.h>
     30  1.2.2.2  tron #if defined(LIBC_SCCS) && !defined(lint)
     31  1.2.2.2  tron __RCSID("$NetBSD: remque.c,v 1.2.2.2 2005/08/04 17:33:23 tron Exp $");
     32  1.2.2.2  tron #endif /* LIBC_SCCS and not lint */
     33  1.2.2.2  tron 
     34  1.2.2.2  tron #include <assert.h>
     35  1.2.2.2  tron #include <search.h>
     36  1.2.2.2  tron 
     37  1.2.2.2  tron struct qelem {
     38  1.2.2.2  tron         struct qelem *q_forw;
     39  1.2.2.2  tron         struct qelem *q_back;
     40  1.2.2.2  tron };
     41  1.2.2.2  tron 
     42  1.2.2.2  tron void
     43  1.2.2.2  tron remque(element)
     44  1.2.2.2  tron 	void *element;
     45  1.2.2.2  tron {
     46  1.2.2.2  tron 	struct qelem *e = (struct qelem *) element;
     47  1.2.2.2  tron 
     48  1.2.2.2  tron 	_DIAGASSERT(e != 0);
     49  1.2.2.2  tron 
     50  1.2.2.2  tron 	e->q_forw->q_back = e->q_back;
     51  1.2.2.2  tron 	e->q_back->q_forw = e->q_forw;
     52  1.2.2.2  tron }
     53