add a function to move llist nodes around

This commit is contained in:
Christian Thaeter 2008-08-11 10:12:05 +02:00
parent f0cf49d753
commit ea97119fa6

View file

@ -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