From ea97119fa675911e4e54058a1eb3eece14eb848a Mon Sep 17 00:00:00 2001 From: Christian Thaeter Date: Mon, 11 Aug 2008 10:12:05 +0200 Subject: [PATCH] add a function to move llist nodes around --- src/lib/llist.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/llist.h b/src/lib/llist.h index 128a3e826..3cb70f8ea 100644 --- a/src/lib/llist.h +++ b/src/lib/llist.h @@ -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