From f8217d240d598f39f70047f7a623dd46312542c6 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 4 Dec 2021 16:01:12 -0800 Subject: Initial commit. --- list/src/list.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 list/src/list.c (limited to 'list/src') 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 @@ +#include "list.h" + +#include + +void list_make(list* list, size_t size) { + if (size == 0) { + return; + } + assert(list); + for (size_t i = 0; i < size; ++i) { + list[i].prev = (i == 0 ? 0 : &list[i - 1]); + list[i].next = (i == size - 1 ? 0 : &list[i + 1]); + } +} -- cgit v1.2.3