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