From 29f6d08310e3a90f9e33c28ed8ffafa7d31217c2 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Thu, 17 Nov 2022 01:22:31 -0600 Subject: [PATCH] Move a node from one list to another --- src/ordinary.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ordinary.c b/src/ordinary.c index e641696..f815c35 100644 --- a/src/ordinary.c +++ b/src/ordinary.c @@ -56,3 +56,20 @@ struct ordinary_node *ordinary_list_add(struct ordinary_list *list, void *val) { return node; } + +void standard_list_mov(struct standard_list *list, struct standard_node *node) { + struct ordinary_node *prev = node->prev; + struct ordinary_node *next = node->next; + + if(prev) { + prev->next = next; + node->prev = NULL; + } + + if(next) { + next->prev = prev; + node->next = NULL; + } + + ordinary_list_insert(list, node); +}