diff options
author | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-06-11 01:00:56 +0200 |
---|---|---|
committer | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-06-11 01:00:56 +0200 |
commit | ddb7d43143ff664948f27cd2cd4e18bdfcce6118 (patch) | |
tree | d36d4579b73e7197262e92f8acc83fc247d4f013 /04_exercise/arena/arena_list.h | |
parent | fad28509e7463082a508b761c797773538df7d27 (diff) | |
download | betriebssysteme-ddb7d43143ff664948f27cd2cd4e18bdfcce6118.tar.gz betriebssysteme-ddb7d43143ff664948f27cd2cd4e18bdfcce6118.zip |
Forgot arena folder
Diffstat (limited to '04_exercise/arena/arena_list.h')
-rw-r--r-- | 04_exercise/arena/arena_list.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/04_exercise/arena/arena_list.h b/04_exercise/arena/arena_list.h new file mode 100644 index 0000000..86bf805 --- /dev/null +++ b/04_exercise/arena/arena_list.h @@ -0,0 +1,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 |