1 /* Taken from depthcharge: src/base/list.c */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 #include <commonlib/list.h>
6 void list_remove(struct list_node
*node
)
9 node
->prev
->next
= node
->next
;
11 node
->next
->prev
= node
->prev
;
14 void list_insert_after(struct list_node
*node
, struct list_node
*after
)
16 node
->next
= after
->next
;
20 node
->next
->prev
= node
;
23 void list_insert_before(struct list_node
*node
, struct list_node
*before
)
25 node
->prev
= before
->prev
;
29 node
->prev
->next
= node
;
32 void list_append(struct list_node
*node
, struct list_node
*head
)
37 list_insert_after(node
, head
);