Skip to content

Commit 4aaf83d

Browse files
committed
tree data UPDATE proper dup support for ext data
Fixes #2385
1 parent 8c22033 commit 4aaf83d

File tree

4 files changed

+368
-112
lines changed

4 files changed

+368
-112
lines changed

src/diff.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,7 @@ lyd_diff_add(const struct lyd_node *node, enum lyd_diff_op op, const char *orig_
412412
}
413413

414414
/* duplicate the subtree (and connect to the diff if possible) */
415-
if (diff_parent) {
416-
LY_CHECK_RET(lyd_dup_single_to_ctx(node, LYD_CTX(diff_parent), (struct lyd_node_inner *)diff_parent,
417-
diff_opts, &dup));
418-
} else {
419-
LY_CHECK_RET(lyd_dup_single(node, NULL, diff_opts, &dup));
420-
}
415+
LY_CHECK_RET(lyd_dup_single(node, (struct lyd_node_inner *)diff_parent, diff_opts, &dup));
421416

422417
/* find the first duplicated parent */
423418
if (!diff_parent) {
@@ -2768,13 +2763,8 @@ lyd_diff_merge_r(const struct lyd_node *src_diff, struct lyd_node *diff_parent,
27682763
} else {
27692764
add_diff:
27702765
/* add new diff node with all descendants */
2771-
if ((src_diff->flags & LYD_EXT) && diff_parent) {
2772-
LY_CHECK_RET(lyd_dup_single_to_ctx(src_diff, LYD_CTX(diff_parent), (struct lyd_node_inner *)diff_parent,
2773-
LYD_DUP_RECURSIVE | LYD_DUP_WITH_FLAGS | LYD_DUP_NO_LYDS, &diff_node));
2774-
} else {
2775-
LY_CHECK_RET(lyd_dup_single(src_diff, (struct lyd_node_inner *)diff_parent,
2776-
LYD_DUP_RECURSIVE | LYD_DUP_WITH_FLAGS | LYD_DUP_NO_LYDS, &diff_node));
2777-
}
2766+
LY_CHECK_RET(lyd_dup_single(src_diff, (struct lyd_node_inner *)diff_parent,
2767+
LYD_DUP_RECURSIVE | LYD_DUP_WITH_FLAGS | LYD_DUP_NO_LYDS, &diff_node));
27782768

27792769
/* insert node into diff if not already */
27802770
if (!diff_parent) {

0 commit comments

Comments
 (0)