add a function to move llist nodes around
This commit is contained in:
parent
f0cf49d753
commit
ea97119fa6
1 changed files with 12 additions and 0 deletions
|
|
@ -306,6 +306,18 @@ LLIST_FUNC (LList llist_relocate (LList self),
|
|||
return self->next->prev = self->prev->next = self;
|
||||
);
|
||||
|
||||
/**
|
||||
* Move a node from one memory location to another.
|
||||
* @param self target of the move, must be uninitialized or empty before this move
|
||||
* @param source source of the move, will be initialized to a empty list after this call
|
||||
* @return self
|
||||
*/
|
||||
LLIST_FUNC (LList llist_move (LList self, LList source),
|
||||
*self = *source;
|
||||
llist_init (source);
|
||||
return llist_relocate (self);
|
||||
);
|
||||
|
||||
/**
|
||||
* Insert a node after another.
|
||||
* @param self node after which we want to insert
|
||||
|
|
|
|||
Loading…
Reference in a new issue