tree data FEATURE function for unlinking siblings
diff --git a/src/tree_data.c b/src/tree_data.c
index ccce0f7..a2c3ef3 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -2737,6 +2737,17 @@
}
API void
+lyd_unlink_siblings(struct lyd_node *node)
+{
+ struct lyd_node *next, *elem, *first = NULL;
+
+ LY_LIST_FOR_SAFE(node, next, elem) {
+ lyd_unlink_tree(elem);
+ lyd_insert_node(NULL, &first, elem, 1);
+ }
+}
+
+API void
lyd_unlink_tree(struct lyd_node *node)
{
struct lyd_node *iter;
diff --git a/src/tree_data.h b/src/tree_data.h
index 8dd55fe..596ab05 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -1721,6 +1721,13 @@
LY_ERR lyd_insert_after(struct lyd_node *sibling, struct lyd_node *node);
/**
+ * @brief Unlink the specified node with all the following siblings.
+ *
+ * @param[in] node Data tree node to be unlinked (together with all the children and following siblings).
+ */
+void lyd_unlink_siblings(struct lyd_node *node);
+
+/**
* @brief Unlink the specified data subtree.
*
* @param[in] node Data tree node to be unlinked (together with all the children).