diff --git a/src/lib/llist.h b/src/lib/llist.h index 128a3e826..353fe4320 100644 --- a/src/lib/llist.h +++ b/src/lib/llist.h @@ -299,6 +299,9 @@ LLIST_FUNC (LList llist_unlink (LList self), /** * Fix a node which got relocated in memory. * It is supported to realloc/move list nodes in memory but one must call 'list_relocate' after doing so. + * IMPORTANT: it is not possible to relocate nodes which are empty this way, nor can this be determined + * after the relocation, so either llist_init them afterwards or insert a bogus node before moving the node + * and relocating it and remove it afterwards. * @param self node which got relocated * @return self */ @@ -306,6 +309,7 @@ LLIST_FUNC (LList llist_relocate (LList self), return self->next->prev = self->prev->next = self; ); + /** * Insert a node after another. * @param self node after which we want to insert diff --git a/tests/15list.tests b/tests/15list.tests index 88aef3c49..e04044f27 100644 --- a/tests/15list.tests +++ b/tests/15list.tests @@ -44,9 +44,11 @@ out: . out: . END +TEST "llist_relocate" relocate <