aboutsummaryrefslogtreecommitdiff
path: root/list/src
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2021-12-04 16:01:12 -0800
committer3gg <3gg@shellblade.net>2021-12-04 16:01:12 -0800
commitf8217d240d598f39f70047f7a623dd46312542c6 (patch)
tree4e40843d665e388416c1226f739c2b8c0b8da736 /list/src
parent5f6ea503cdb6ad4a95b679672a1ad324d96c89a5 (diff)
Initial commit.
Diffstat (limited to 'list/src')
-rw-r--r--list/src/list.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/list/src/list.c b/list/src/list.c
new file mode 100644
index 0000000..f5b6507
--- /dev/null
+++ b/list/src/list.c
@@ -0,0 +1,14 @@
1#include "list.h"
2
3#include <assert.h>
4
5void list_make(list* list, size_t size) {
6 if (size == 0) {
7 return;
8 }
9 assert(list);
10 for (size_t i = 0; i < size; ++i) {
11 list[i].prev = (i == 0 ? 0 : &list[i - 1]);
12 list[i].next = (i == size - 1 ? 0 : &list[i + 1]);
13 }
14}