tree data BUGFIX support for ext data
diff --git a/src/diff.c b/src/diff.c
index a283e2a..4ff4935 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -26,6 +26,7 @@
#include "compat.h"
#include "context.h"
#include "log.h"
+#include "plugins_exts.h"
#include "plugins_types.h"
#include "set.h"
#include "tree.h"
@@ -1076,7 +1077,11 @@
/* insert it at the end */
ret = 0;
if (parent_node) {
- ret = lyd_insert_child(parent_node, match);
+ if (match->flags & LYD_EXT) {
+ ret = lyd_insert_ext(parent_node, match);
+ } else {
+ ret = lyd_insert_child(parent_node, match);
+ }
} else {
ret = lyd_insert_sibling(*first_node, match, first_node);
}
diff --git a/src/tree_data.c b/src/tree_data.c
index 0bf1e2d..fff9f3d 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -3560,6 +3560,11 @@
LY_CHECK_ARG_RET(NULL, node, LY_EINVAL);
+ if (node->flags & LYD_EXT) {
+ /* we need to use the same context */
+ trg_ctx = LYD_CTX(node);
+ }
+
if (!node->schema) {
dup = calloc(1, sizeof(struct lyd_node_opaq));
((struct lyd_node_opaq *)dup)->ctx = trg_ctx;
@@ -3591,7 +3596,7 @@
if (options & LYD_DUP_WITH_FLAGS) {
dup->flags = node->flags;
} else {
- dup->flags = (node->flags & LYD_DEFAULT) | LYD_NEW;
+ dup->flags = (node->flags & (LYD_DEFAULT | LYD_EXT)) | LYD_NEW;
}
if (trg_ctx == LYD_CTX(node)) {
dup->schema = node->schema;