xref: /dflybsd-src/lib/libc/stdlib/remque.c (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /*
2*86d7f5d3SJohn Marino  * Initial implementation:
3*86d7f5d3SJohn Marino  * Copyright (c) 2002 Robert Drehmel
4*86d7f5d3SJohn Marino  * All rights reserved.
5*86d7f5d3SJohn Marino  *
6*86d7f5d3SJohn Marino  * As long as the above copyright statement and this notice remain
7*86d7f5d3SJohn Marino  * unchanged, you can do what ever you want with this file.
8*86d7f5d3SJohn Marino  *
9*86d7f5d3SJohn Marino  * $FreeBSD: src/lib/libc/stdlib/remque.c,v 1.3 2003/01/04 07:34:41 tjr Exp $
10*86d7f5d3SJohn Marino  */
11*86d7f5d3SJohn Marino 
12*86d7f5d3SJohn Marino #define	_SEARCH_PRIVATE
13*86d7f5d3SJohn Marino #include <search.h>
14*86d7f5d3SJohn Marino #include <stdlib.h>	/* for NULL */
15*86d7f5d3SJohn Marino 
16*86d7f5d3SJohn Marino void
remque(void * element)17*86d7f5d3SJohn Marino remque(void *element)
18*86d7f5d3SJohn Marino {
19*86d7f5d3SJohn Marino 	struct que_elem *prev, *next, *elem;
20*86d7f5d3SJohn Marino 
21*86d7f5d3SJohn Marino 	elem = (struct que_elem *)element;
22*86d7f5d3SJohn Marino 
23*86d7f5d3SJohn Marino 	prev = elem->prev;
24*86d7f5d3SJohn Marino 	next = elem->next;
25*86d7f5d3SJohn Marino 
26*86d7f5d3SJohn Marino 	if (prev != NULL)
27*86d7f5d3SJohn Marino 		prev->next = next;
28*86d7f5d3SJohn Marino 	if (next != NULL)
29*86d7f5d3SJohn Marino 		next->prev = prev;
30*86d7f5d3SJohn Marino }
31