@@ -643,8 +643,8 @@ ly_path_compile_snode(const struct ly_ctx *ctx, const struct lysc_node *cur_node
643643
644644LY_ERR
645645ly_path_compile_predicate (const struct ly_ctx * ctx , const struct lysc_node * cur_node , const struct lys_module * cur_mod ,
646- const struct lysc_node * ctx_node , const struct lyxp_expr * expr , uint32_t * tok_idx , LY_VALUE_FORMAT format ,
647- void * prefix_data , struct ly_path_predicate * * predicates )
646+ const struct lysc_node * ctx_node , const struct lysc_ext_instance * top_ext , const struct lyxp_expr * expr ,
647+ uint32_t * tok_idx , LY_VALUE_FORMAT format , void * prefix_data , struct ly_path_predicate * * predicates )
648648{
649649 LY_ERR rc = LY_SUCCESS , r ;
650650 struct ly_path_predicate * p ;
@@ -716,7 +716,8 @@ ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_
716716
717717 /* do not store the canonical value, only validate */
718718 LOG_LOCSET (key , NULL );
719- r = lyd_value_validate2 (ctx_node -> module -> ctx , key , val , val_len , format , prefix_data , NULL , NULL , & p -> value );
719+ r = lyd_value_validate2 (ctx_node -> module -> ctx , key , val , val_len , format , prefix_data , NULL , top_ext ,
720+ NULL , & p -> value );
720721 LOG_LOCBACK (1 , 0 );
721722 LY_CHECK_ERR_GOTO (r && (r != LY_EINCOMPLETE ), rc = r , cleanup );
722723
@@ -774,7 +775,8 @@ ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_
774775
775776 /* do not store the value, only validate */
776777 LOG_LOCSET (ctx_node , NULL );
777- r = lyd_value_validate2 (ctx_node -> module -> ctx , ctx_node , val , val_len , format , prefix_data , NULL , NULL , & p -> value );
778+ r = lyd_value_validate2 (ctx_node -> module -> ctx , ctx_node , val , val_len , format , prefix_data , NULL , top_ext , NULL ,
779+ & p -> value );
778780 LOG_LOCBACK (1 , 0 );
779781 LY_CHECK_ERR_GOTO (r && (r != LY_EINCOMPLETE ), rc = r , cleanup );
780782
@@ -1187,6 +1189,8 @@ _ly_path_compile(const struct ly_ctx *ctx, const struct lys_module *cur_mod, con
11871189
11881190 if (oper == LY_PATH_OPER_OUTPUT ) {
11891191 getnext_opts = LYS_GETNEXT_OUTPUT ;
1192+ } else if (top_ext ) {
1193+ getnext_opts = LYS_GETNEXT_EXT_XPATH ;
11901194 } else {
11911195 getnext_opts = 0 ;
11921196 }
@@ -1263,7 +1267,7 @@ _ly_path_compile(const struct ly_ctx *ctx, const struct lys_module *cur_mod, con
12631267 if (lref ) {
12641268 rc = ly_path_compile_predicate_leafref (ctx_node , cur_node , expr , & tok_idx , format , prefix_data );
12651269 } else {
1266- rc = ly_path_compile_predicate (ctx , cur_node , cur_mod , ctx_node , expr , & tok_idx , format , prefix_data ,
1270+ rc = ly_path_compile_predicate (ctx , cur_node , cur_mod , ctx_node , top_ext , expr , & tok_idx , format , prefix_data ,
12671271 & p -> predicates );
12681272 }
12691273 LY_CHECK_GOTO (rc , cleanup );
@@ -1314,7 +1318,7 @@ ly_path_compile_leafref(const struct ly_ctx *ctx, const struct lysc_node *ctx_no
13141318
13151319LY_ERR
13161320ly_path_eval_partial (const struct ly_path * path , const struct lyd_node * start , const struct lyxp_var * vars ,
1317- ly_bool with_opaq , LY_ARRAY_COUNT_TYPE * path_idx , struct lyd_node * * match )
1321+ const struct lysc_ext_instance * top_ext , ly_bool with_opaq , LY_ARRAY_COUNT_TYPE * path_idx , struct lyd_node * * match )
13181322{
13191323 LY_ARRAY_COUNT_TYPE u ;
13201324 struct lyd_node * prev_node = NULL , * elem , * node = NULL , * target ;
@@ -1352,14 +1356,16 @@ ly_path_eval_partial(const struct ly_path *path, const struct lyd_node *start, c
13521356 break ;
13531357 case LY_PATH_PREDTYPE_LEAFLIST :
13541358 /* we will use hashes to find one leaf-list instance */
1355- LY_CHECK_RET (lyd_create_term_canon (path [u ].node , path [u ].predicates [0 ].value , & target ));
1359+ LY_CHECK_RET (lyd_create_term (path [u ].node , path [u ].predicates [0 ].value ,
1360+ strlen (path [u ].predicates [0 ].value ) * 8 , 1 , 1 , NULL , LY_VALUE_CANON , NULL , LYD_HINT_DATA ,
1361+ top_ext , NULL , & target ));
13561362 lyd_find_sibling_first (start , target , & node );
13571363 lyd_free_tree (target );
13581364 break ;
13591365 case LY_PATH_PREDTYPE_LIST_VAR :
13601366 case LY_PATH_PREDTYPE_LIST :
13611367 /* we will use hashes to find one list instance */
1362- LY_CHECK_RET (lyd_create_list (path [u ].node , path [u ].predicates , vars , 1 , & target ));
1368+ LY_CHECK_RET (lyd_create_list (path [u ].node , path [u ].predicates , vars , 1 , top_ext , & target ));
13631369 lyd_find_sibling_first (start , target , & node );
13641370 lyd_free_tree (target );
13651371 break ;
@@ -1419,12 +1425,13 @@ ly_path_eval_partial(const struct ly_path *path, const struct lyd_node *start, c
14191425}
14201426
14211427LY_ERR
1422- ly_path_eval (const struct ly_path * path , const struct lyd_node * start , const struct lyxp_var * vars , struct lyd_node * * match )
1428+ ly_path_eval (const struct ly_path * path , const struct lyd_node * start , const struct lyxp_var * vars ,
1429+ const struct lysc_ext_instance * top_ext , struct lyd_node * * match )
14231430{
14241431 LY_ERR ret ;
14251432 struct lyd_node * m ;
14261433
1427- ret = ly_path_eval_partial (path , start , vars , 0 , NULL , & m );
1434+ ret = ly_path_eval_partial (path , start , vars , top_ext , 0 , NULL , & m );
14281435
14291436 if (ret == LY_SUCCESS ) {
14301437 /* last node was found */
0 commit comments