Function llist_splice

Function Documentation

status_t llist_splice(struct llist *list1, struct llist *list2, const struct llist_node *node)

Splice two llist objects together.

This function inserts the second list at the position of the specified node in list1. To append list2 to list1, pass list1->last as the node. To prepend list2 to list1, pass list1->first as the node. Any further use of the list2 pointer after this function is called is undefined.

This works as expected except if list1 only has a single node, because its first and last fields both point to the same node in that case. For this, passing list->last (appending)produces the same result as passing list->first (prepending).

Parameters:
  • list1 – The linked list handle for the splicer.

  • list2 – The linked list handle for the splicee.

  • node – The node in list1 to insert the 2nd list at.

Returns:

status_t