blob: 86bf8058a14a413f209cae40a2cabfce0f6f6c10 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
//
// Created by stefan on 10.06.20.
//
#ifndef BETRIEBSYSTEME_ARENA_LIST_H
#define BETRIEBSYSTEME_ARENA_LIST_H
#include <stdlib.h>
typedef struct Node {
void * value;
struct Node * next;
struct Node * prev;
} Node;
typedef struct List {
Node * first;
Node * last;
} List;
// This structure manages an arena / memory slab to be used
typedef struct ArenaList {
List freeList;
List activeList;
} ArenaList;
//Initializes the node array
ArenaList alInit(Node * arena, size_t size);
// Return -1 if the List is full
int alPush(ArenaList* al, void * value);
// Return -1 if the Node was already deleted
int alRemove(ArenaList* al, Node * node);
// Return -1 if the Node was already deleted
int alRemoveElem(ArenaList* al, void * value);
#endif // BETRIEBSYSTEME_ARENA_LIST_H
|