From 980170d88f33a35f3e1f0b6f7709d21e68a39d7f Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 12 Aug 2017 10:10:28 +0200 Subject: [PATCH] Add list _splice_back --- m-i-list.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/m-i-list.h b/m-i-list.h index a0e93bdc..2e56b08f 100644 --- a/m-i-list.h +++ b/m-i-list.h @@ -407,7 +407,21 @@ typedef struct ilist_head_s { ILISTI_CONTRACT(name, list1); \ ILISTI_CONTRACT(name, list2); \ } \ - -// TODO: splice_back & it_insert + \ + static inline void \ + M_C(name, _splice_back)(list_t nv, list_t ov, list_it_t it) \ + { \ + ILISTI_CONTRACT(name, nv); \ + ILISTI_CONTRACT(name, ov); \ + assert (it != NULL); \ + (void) ov; \ + type *obj = M_C(name, _ref)(it); \ + M_C(name, _unlink)(obj); \ + M_C(name, _push_back)(nv, obj); \ + ILISTI_CONTRACT(name, nv); \ + ILISTI_CONTRACT(name, ov); \ + } \ + +// TODO: it_insert #endif