Move a node from one list to another

This commit is contained in:
Nick Chambers 2022-11-17 01:22:31 -06:00
parent 242b07a949
commit 29f6d08310
1 changed files with 17 additions and 0 deletions

View File

@ -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);
}