@@ -1534,28 +1534,43 @@ lyd_diff_merge_replace(struct lyd_node *diff_match, enum lyd_diff_op cur_op, con
1534
1534
}
1535
1535
break ;
1536
1536
case LYD_DIFF_OP_NONE :
1537
- /* it is moved now */
1538
- assert (lysc_is_userordered (diff_match -> schema ) && (diff_match -> schema -> nodetype == LYS_LIST ));
1537
+ switch (diff_match -> schema -> nodetype ) {
1538
+ case LYS_LIST :
1539
+ /* it is moved now */
1540
+ assert (lysc_is_userordered (diff_match -> schema ));
1539
1541
1540
- /* change the operation */
1541
- LY_CHECK_RET (lyd_diff_change_op (diff_match , LYD_DIFF_OP_REPLACE ));
1542
+ /* change the operation */
1543
+ LY_CHECK_RET (lyd_diff_change_op (diff_match , LYD_DIFF_OP_REPLACE ));
1542
1544
1543
- /* set orig-meta and meta */
1544
- if (lysc_is_dup_inst_list (diff_match -> schema )) {
1545
- meta_name = "position" ;
1546
- orig_meta_name = "orig-position" ;
1547
- } else {
1548
- meta_name = "key" ;
1549
- orig_meta_name = "orig-key" ;
1550
- }
1545
+ /* set orig-meta and meta */
1546
+ if (lysc_is_dup_inst_list (diff_match -> schema )) {
1547
+ meta_name = "position" ;
1548
+ orig_meta_name = "orig-position" ;
1549
+ } else {
1550
+ meta_name = "key" ;
1551
+ orig_meta_name = "orig-key" ;
1552
+ }
1551
1553
1552
- meta = lyd_find_meta (src_diff -> meta , mod , orig_meta_name );
1553
- LY_CHECK_ERR_RET (!meta , LOGERR_META (ctx , orig_meta_name , src_diff ), LY_EINVAL );
1554
- LY_CHECK_RET (lyd_dup_meta_single (meta , diff_match , NULL ));
1554
+ meta = lyd_find_meta (src_diff -> meta , mod , orig_meta_name );
1555
+ LY_CHECK_ERR_RET (!meta , LOGERR_META (ctx , orig_meta_name , src_diff ), LY_EINVAL );
1556
+ LY_CHECK_RET (lyd_dup_meta_single (meta , diff_match , NULL ));
1555
1557
1556
- meta = lyd_find_meta (src_diff -> meta , mod , meta_name );
1557
- LY_CHECK_ERR_RET (!meta , LOGERR_META (ctx , meta_name , src_diff ), LY_EINVAL );
1558
- LY_CHECK_RET (lyd_dup_meta_single (meta , diff_match , NULL ));
1558
+ meta = lyd_find_meta (src_diff -> meta , mod , meta_name );
1559
+ LY_CHECK_ERR_RET (!meta , LOGERR_META (ctx , meta_name , src_diff ), LY_EINVAL );
1560
+ LY_CHECK_RET (lyd_dup_meta_single (meta , diff_match , NULL ));
1561
+ break ;
1562
+ case LYS_LEAF :
1563
+ /* only dflt flag changed, now value changed as well, update the operation */
1564
+ LY_CHECK_RET (lyd_diff_change_op (diff_match , LYD_DIFF_OP_REPLACE ));
1565
+
1566
+ /* modify the node value */
1567
+ if (lyd_change_term (diff_match , lyd_get_value (src_diff ))) {
1568
+ LOGINT_RET (LYD_CTX (src_diff ));
1569
+ }
1570
+ break ;
1571
+ default :
1572
+ LOGINT_RET (LYD_CTX (src_diff ));
1573
+ }
1559
1574
break ;
1560
1575
default :
1561
1576
/* delete operation is not valid */
0 commit comments