discover/grub2: Allow to separate the --id argument using a space char
[petitboot] / lib / list / list.c
1
2 #include "list/list.h"
3
4 void list_init(struct list *list)
5 {
6         list->head.next = &list->head;
7         list->head.prev = &list->head;
8 }
9
10 void list_insert_before(struct list_item *next, struct list_item *item)
11 {
12         item->next = next;
13         item->prev = next->prev;
14         next->prev->next = item;
15         next->prev = item;
16 }
17
18 void list_insert_after(struct list_item *prev, struct list_item *item)
19 {
20         item->next = prev->next;
21         item->prev = prev;
22         prev->next->prev = item;
23         prev->next = item;
24 }
25
26 void list_remove(struct list_item *item)
27 {
28         item->next->prev = item->prev;
29         item->prev->next = item->next;
30 }