summaryrefslogtreecommitdiff
path: root/kernel/src/libk/list.c
blob: 21dac1602e0ef86744aebc26a2be8ca42ef08b53 (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 (list_is_empty(head)) {
		head = NULL;
		return;
	}

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