Skip to content

Commit

Permalink
tree data UPDATE add ability to duplicate tree with priv pointers
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Ryzhov <[email protected]>
  • Loading branch information
idryzhov authored and michalvasko committed Oct 31, 2023
1 parent dc0c720 commit 9e7af66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tree_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,9 @@ lyd_dup_r(const struct lyd_node *node, const struct ly_ctx *trg_ctx, struct lyd_
} else {
dup->flags = (node->flags & (LYD_DEFAULT | LYD_EXT)) | LYD_NEW;
}
if (options & LYD_DUP_WITH_PRIV) {
dup->priv = node->priv;
}
if (trg_ctx == LYD_CTX(node)) {
dup->schema = node->schema;
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/tree_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -1962,6 +1962,8 @@ LIBYANG_API_DECL LY_ERR lyd_compare_meta(const struct lyd_meta *meta1, const str
#define LYD_DUP_WITH_FLAGS 0x08 /**< Also copy any data node flags. That will cause the duplicated data to preserve
its validation/default node state. */
#define LYD_DUP_NO_EXT 0x10 /**< Do not duplicate nodes with the ::LYD_EXT flag (nested extension instance data). */
#define LYD_DUP_WITH_PRIV 0x20 /**< Also copy data node private pointer. Only the pointer is copied, it still points
to the same data. */

/** @} dupoptions */

Expand Down

0 comments on commit 9e7af66

Please sign in to comment.