summaryrefslogtreecommitdiffstats
path: root/lib/list/list.c
blob: d9bc5324f25a645223a496de0292188e02da7cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

#include "list/list.h"

void list_init(struct list *list)
{
	list->head.next = &list->head;
	list->head.prev = &list->head;
}

void list_add(struct list *list, struct list_item *new)
{
	new->next = list->head.next;
	new->prev = &list->head;

	list->head.next->prev = new;
	list->head.next = new;
}

void list_remove(struct list_item *item)
{
	item->next->prev = item->prev;
	item->prev->next = item->next;
}

OpenPOWER on IntegriCloud