Skip to content

Commit 820d68b

Browse files
committed
tree data BUGFIX dup inst search with mounted data
1 parent 1b00ed6 commit 820d68b

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ lyd_diff_find_match(const struct lyd_node *siblings, const struct lyd_node *targ
985985
}
986986

987987
/* update match as needed */
988-
LY_CHECK_RET(lyd_dup_inst_next(match, siblings, dup_inst_ht));
988+
LY_CHECK_RET(lyd_dup_inst_next(match, dup_inst_ht));
989989

990990
if (*match && ((*match)->flags & LYD_DEFAULT) && !defaults) {
991991
/* ignore default nodes */

src/tree_data.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,7 +2724,7 @@ lyd_merge_sibling_r(struct lyd_node **first_trg, struct lyd_node *parent_trg,
27242724

27252725
if (match_trg) {
27262726
/* update match as needed */
2727-
LY_CHECK_RET(lyd_dup_inst_next(&match_trg, *first_trg, dup_inst));
2727+
LY_CHECK_RET(lyd_dup_inst_next(&match_trg, dup_inst));
27282728
} else {
27292729
/* first instance of this node */
27302730
first_inst = 1;
@@ -2821,7 +2821,7 @@ lyd_merge_sibling_r(struct lyd_node **first_trg, struct lyd_node *parent_trg,
28212821

28222822
if (first_inst) {
28232823
/* remember not to find this instance next time */
2824-
LY_CHECK_RET(lyd_dup_inst_next(&dup_src, *first_trg, dup_inst));
2824+
LY_CHECK_RET(lyd_dup_inst_next(&dup_src, dup_inst));
28252825
}
28262826

28272827
/* call callback, no source node */

src/tree_data_common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ lyd_dup_inst_get(const struct lyd_node *first_inst, struct ly_ht **dup_inst_ht)
105105
}
106106

107107
LY_ERR
108-
lyd_dup_inst_next(struct lyd_node **inst, const struct lyd_node *siblings, struct ly_ht **dup_inst_ht)
108+
lyd_dup_inst_next(struct lyd_node **inst, struct ly_ht **dup_inst_ht)
109109
{
110110
struct lyd_dup_inst *dup_inst;
111111

@@ -117,11 +117,11 @@ lyd_dup_inst_next(struct lyd_node **inst, const struct lyd_node *siblings, struc
117117
/* there can be more exact same instances (even if not allowed in invalid data) and we must make sure we do not
118118
* match a single node more times */
119119
dup_inst = lyd_dup_inst_get(*inst, dup_inst_ht);
120-
LY_CHECK_ERR_RET(!dup_inst, LOGMEM(LYD_CTX(siblings)), LY_EMEM);
120+
LY_CHECK_ERR_RET(!dup_inst, LOGMEM(LYD_CTX(*inst)), LY_EMEM);
121121

122122
if (!dup_inst->used) {
123-
/* we did not cache these instances yet, do so */
124-
lyd_find_sibling_dup_inst_set(siblings, *inst, &dup_inst->set);
123+
/* we did not cache these instances yet, do so (use the same inst in case it is from a mount-point) */
124+
lyd_find_sibling_dup_inst_set(*inst, *inst, &dup_inst->set);
125125
assert(dup_inst->set->count && (dup_inst->set->dnodes[0] == *inst));
126126
}
127127

src/tree_data_internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ struct lyd_dup_inst {
4747
* (that should not be considered next time) instance.
4848
*
4949
* @param[in,out] inst Found instance, is updated so that the same instance is not returned twice.
50-
* @param[in] siblings Siblings where @p inst was found.
5150
* @param[in] dup_inst_ht Duplicate instance cache hash table.
5251
* @return LY_ERR value.
5352
*/
54-
LY_ERR lyd_dup_inst_next(struct lyd_node **inst, const struct lyd_node *siblings, struct ly_ht **dup_inst_ht);
53+
LY_ERR lyd_dup_inst_next(struct lyd_node **inst, struct ly_ht **dup_inst_ht);
5554

5655
/**
5756
* @brief Free duplicate instance cache.

0 commit comments

Comments
 (0)