aboutsummaryrefslogtreecommitdiff
path: root/kernel/lib/queue.c
blob: 38ef8cf779bbad6c1e4901797ae7584cbf7c6db2 (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 <lib/queue.h>

void push_to_queue(struct Entry* e, struct Queue* q)
{
	e->next = q->start.next;
	q->start.next = e;
}

struct Entry* pop_from_queue(struct Queue* q)
{
	if (q->start.next == 0)
		return 0;
	struct Entry* e = q->start.next;
	q->start.next = e->next;
	return e;
}

struct Entry* remove_next_from_queue(struct Entry* e) {
	if (e->next == 0)
		return 0;
	struct Entry* next = e->next;
	e->next = next->next;
	return next;
}