return true;
}
-/** Link in an entry after the current entry
+/** Link in a single entry after the current entry
*
* @param[in] entry to link in entry after.
* @param[in] to_link entry to link in after.
entry->next = to_link;
}
-/** Link in an entry before the current entry
+/** Link in a single entry before the current entry
*
* @param[in] entry to link in entry before.
* @param[in] to_link entry to link in before.
entry->prev = to_link;
}
+/** Link in a sublist before the current entry
+ *
+ * @note This is not suitable for moving elements from a fr_dlist_head_t as
+ * we need to snip out the head element. This is only suitable if the
+ * two entries are not part of lists with head elements.
+ *
+ * @param[in] dst to link src in before.
+ * @param[in] src to link in before dst.
+ */
+static inline CC_HINT(nonnull) void fr_dlist_entry_move(fr_dlist_t *dst, fr_dlist_t *src)
+{
+ fr_dlist_t *src_end = src->prev;
+
+ dst->prev->next = src;
+ src->prev->next = dst;
+ src->prev = dst->prev;
+ dst->prev = src_end;
+}
+
/** Replace one entry with another
*
* @param[in] entry to replace.
if (fr_dlist_empty(list_src)) return;
+ /*
+ * This is different to fr_dlist_entry_move
+ * because we need need to snip out the
+ * list head entry from the src.
+ */
src->prev->next = dst;
src->next->prev = dst->prev;