tree data BUGFIX creating implicit nodes
It is not possible to determine which nodes were
added in the same run of creating implicit nodes.
Refs sysrepo/sysrepo#3115
diff --git a/src/tree_data_new.c b/src/tree_data_new.c
index 548e6df..090e7ac 100644
--- a/src/tree_data_new.c
+++ b/src/tree_data_new.c
@@ -1903,9 +1903,7 @@
}
LYD_TREE_DFS_BEGIN(tree, node) {
- /* skip added default nodes */
- if (((node->flags & (LYD_DEFAULT | LYD_NEW)) != (LYD_DEFAULT | LYD_NEW)) &&
- (node->schema->nodetype & LYD_NODE_INNER)) {
+ if (node->schema->nodetype & LYD_NODE_INNER) {
LY_CHECK_GOTO(ret = lyd_new_implicit_r(node, lyd_node_child_p(node), NULL, NULL, &node_when, NULL,
NULL, implicit_options, diff), cleanup);
}
@@ -1990,16 +1988,12 @@
/* process nested nodes */
LY_LIST_FOR(*tree, root) {
- /* skip added default nodes */
- if ((root->flags & (LYD_DEFAULT | LYD_NEW)) != (LYD_DEFAULT | LYD_NEW)) {
- LY_CHECK_GOTO(ret = lyd_new_implicit_tree(root, implicit_options, diff ? &d : NULL), cleanup);
+ LY_CHECK_GOTO(ret = lyd_new_implicit_tree(root, implicit_options, diff ? &d : NULL), cleanup);
- if (d) {
- /* merge into one diff */
- lyd_insert_sibling(*diff, d, diff);
-
- d = NULL;
- }
+ if (d) {
+ /* merge into one diff */
+ lyd_insert_sibling(*diff, d, diff);
+ d = NULL;
}
}