@@ -5419,7 +5419,6 @@ moveto_root(struct lyxp_set *set, uint32_t options)
54195419 * @brief Check @p node as a part of NameTest processing.
54205420 *
54215421 * @param[in] node Node to check.
5422- * @param[in] ctx_node Context node.
54235422 * @param[in] set Set to read general context from.
54245423 * @param[in] node_name Node name in the dictionary to move to, NULL for any node.
54255424 * @param[in] moveto_mod Expected module of the node, NULL for no prefix.
@@ -5428,36 +5427,14 @@ moveto_root(struct lyxp_set *set, uint32_t options)
54285427 * LY_EINVAL if netither node nor any children match)
54295428 */
54305429static LY_ERR
5431- moveto_node_check (const struct lyd_node * node , const struct lyd_node * ctx_node , const struct lyxp_set * set ,
5432- const char * node_name , const struct lys_module * moveto_mod , uint32_t options )
5430+ moveto_node_check (const struct lyd_node * node , const struct lyxp_set * set , const char * node_name ,
5431+ const struct lys_module * moveto_mod , uint32_t options )
54335432{
54345433 if (!node -> schema ) {
54355434 /* opaque node never matches */
54365435 return LY_ENOT ;
54375436 }
54385437
5439- if (!moveto_mod && (!node_name || strcmp (node_name , "*" ))) {
5440- switch (set -> format ) {
5441- case LY_VALUE_SCHEMA :
5442- case LY_VALUE_SCHEMA_RESOLVED :
5443- /* use current module */
5444- moveto_mod = set -> cur_mod ;
5445- break ;
5446- case LY_VALUE_JSON :
5447- case LY_VALUE_LYB :
5448- /* inherit module of the context node, if any */
5449- if (ctx_node ) {
5450- moveto_mod = ctx_node -> schema -> module ;
5451- }
5452- break ;
5453- case LY_VALUE_CANON :
5454- case LY_VALUE_XML :
5455- /* not defined */
5456- LOGINT (set -> ctx );
5457- return LY_EINVAL ;
5458- }
5459- }
5460-
54615438 /* module check */
54625439 if (moveto_mod && (node -> schema -> module != moveto_mod )) {
54635440 return LY_ENOT ;
@@ -5555,7 +5532,7 @@ static LY_ERR
55555532moveto_node (struct lyxp_set * set , const struct lys_module * moveto_mod , const char * ncname , uint32_t options )
55565533{
55575534 uint32_t i ;
5558- const struct lyd_node * siblings , * sub , * ctx_node ;
5535+ const struct lyd_node * siblings , * sub ;
55595536 LY_ERR rc ;
55605537
55615538 if (options & LYXP_SKIP_EXPR ) {
@@ -5574,16 +5551,14 @@ moveto_node(struct lyxp_set *set, const struct lys_module *moveto_mod, const cha
55745551 assert (!set -> val .nodes [i ].node );
55755552
55765553 /* search in all the trees */
5577- ctx_node = NULL ;
55785554 siblings = set -> tree ;
55795555 } else {
55805556 /* search in children */
5581- ctx_node = set -> val .nodes [i ].node ;
5582- siblings = lyd_child (ctx_node );
5557+ siblings = lyd_child (set -> val .nodes [i ].node );
55835558 }
55845559
55855560 for (sub = siblings ; sub ; sub = sub -> next ) {
5586- rc = moveto_node_check (sub , ctx_node , set , ncname , moveto_mod , options );
5561+ rc = moveto_node_check (sub , set , ncname , moveto_mod , options );
55875562 if (rc == LY_SUCCESS ) {
55885563 if (!replaced ) {
55895564 set_replace_node (set , sub , 0 , LYXP_NODE_ELEM , i );
@@ -5831,7 +5806,7 @@ moveto_node_alldesc(struct lyxp_set *set, const struct lys_module *moveto_mod, c
58315806 /* TREE DFS */
58325807 start = set -> val .nodes [i ].node ;
58335808 for (elem = next = start ; elem ; elem = next ) {
5834- rc = moveto_node_check (elem , start , set , ncname , moveto_mod , options );
5809+ rc = moveto_node_check (elem , set , ncname , moveto_mod , options );
58355810 if (!rc ) {
58365811 /* add matching node into result set */
58375812 set_insert_node (& ret_set , elem , 0 , LYXP_NODE_ELEM , ret_set .used );
0 commit comments