projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
refactor thrd_sleep and nanosleep in terms of clock_nanosleep
[oweals/musl.git]
/
src
/
search
/
insque.c
1
#include <search.h>
2
3
struct node {
4
struct node *next;
5
struct node *prev;
6
};
7
8
void insque(void *element, void *pred)
9
{
10
struct node *e = element;
11
struct node *p = pred;
12
13
if (!p) {
14
e->next = e->prev = 0;
15
return;
16
}
17
e->next = p->next;
18
e->prev = p;
19
p->next = e;
20
if (e->next)
21
e->next->prev = e;
22
}
23
24
void remque(void *element)
25
{
26
struct node *e = element;
27
28
if (e->next)
29
e->next->prev = e->prev;
30
if (e->prev)
31
e->prev->next = e->next;
32
}