summaryrefslogtreecommitdiff
path: root/kernel/src/libk/list.c
blob: cb916ab69da7f3f5955eed534ef87a442ae23a3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <libk/list.h>
#include <heap.h>

void add_to_list(list_t* head, list_t* prev, list_t* next)
{
	head->prev = prev;
	head->next = next;
	prev->next = head;
	next->prev = head;
}

void free_node(list_t* head)
{
	if (head->prev == head->next) {
		head = NULL;
		return;
	}

	head->next->prev = head->prev;
	head->prev->next = head->next;
	head = NULL;
}