Move a node from one list to another
This commit is contained in:
parent
242b07a949
commit
29f6d08310
|
@ -56,3 +56,20 @@ struct ordinary_node *ordinary_list_add(struct ordinary_list *list, void *val) {
|
||||||
|
|
||||||
return node;
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue