FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
linkedlist.h
Go to the documentation of this file.
1
10#ifndef __LINKEDLIST_H_
11#define __LINKEDLIST_H_
12
13#include <stdint.h>
14#include <stdbool.h>
15
17{
18 struct list_node *prev;
19 void* data;
20 struct list_node *next;
21};
22
23typedef struct
24{
25 struct list_node *start;
26 struct list_node *end;
27 uint64_t size;
28} list;
29
35void list_init(list *obj);
36
42void list_clear(list *obj);
43
51bool list_empty(list *obj);
52
59void list_push_back(list *obj, void* data);
60
68void* list_pop_back(list *obj);
69
78struct list_node* list_at(list *obj, int index);
79
88void* list_get(list *obj, int index);
89
90#endif
void * list_get(list *obj, int index)
Gets the contents of a list.
struct list_node * list_at(list *obj, int index)
Gets a node of a list.
void list_init(list *obj)
Initializes a list.
void * list_pop_back(list *obj)
Removes the last element from the list and returns it's value.
void list_clear(list *obj)
Clears a lists ontents.
bool list_empty(list *obj)
Checks if the list is empty.
void list_push_back(list *obj, void *data)
Adds an object to the list.