@@ -751,30 +751,30 @@ static const struct lysc_node *nb_op_sib_next(struct nb_op_yield_state *ys,
751
751
752
752
/*
753
753
* If the node info stack is shorter than the schema path then we are
754
- * doign specific query still on the node from the schema path (should
755
- * match) so just return NULL (i.e., don't process siblings)
754
+ * working our way down the specific query path so just return NULL
755
+ * (i.e., don't process siblings)
756
756
*/
757
757
if (darr_len (ys -> schema_path ) > darr_len (ys -> node_infos ))
758
758
return NULL ;
759
759
/*
760
760
* If sib is on top of the node info stack then
761
761
* 1) it's a container node -or-
762
762
* 2) it's a list node that we were walking and we've reach the last entry
763
- * 3) if sib is a list and the list was empty we never would have
763
+ *
764
+ * If sib is a list and the list was empty we never would have
764
765
* pushed sib on the stack so the top of the stack is the parent
765
766
*
766
767
* If the query string included this node then we do not process any
767
768
* siblings as we are not walking all the parent's children just this
768
769
* specified one give by the query string.
769
770
*/
770
- if (sib == darr_last (ys -> node_infos )-> schema &&
771
- darr_len (ys -> schema_path ) >= darr_len (ys -> node_infos ))
772
- return NULL ;
773
- /* case (3) */
774
- else if (sib -> nodetype == LYS_LIST &&
775
- parent == darr_last (ys -> node_infos )-> schema &&
776
- darr_len (ys -> schema_path ) > darr_len (ys -> node_infos ))
777
- return NULL ;
771
+ if (darr_len (ys -> schema_path ) == darr_len (ys -> node_infos )) {
772
+ struct nb_op_node_info * node_infos = darr_last (ys -> node_infos );
773
+
774
+ assert (node_infos );
775
+ if (sib == node_infos -> schema )
776
+ return NULL ;
777
+ }
778
778
779
779
sib = __sib_next (yn , sib -> next );
780
780
if (sib )
@@ -801,6 +801,7 @@ static const struct lysc_node *nb_op_sib_first(struct nb_op_yield_state *ys,
801
801
{
802
802
const struct lysc_node * sib = lysc_node_child (parent );
803
803
const struct lysc_node * first_sib ;
804
+ struct nb_op_node_info * last = darr_last (ys -> node_infos );
804
805
805
806
/*
806
807
* NOTE: when we want to handle root level walks we will need to use
@@ -817,10 +818,9 @@ static const struct lysc_node *nb_op_sib_first(struct nb_op_yield_state *ys,
817
818
* base of the user query, return the next schema node from the query
818
819
* string (schema_path).
819
820
*/
820
- if (darr_last (ys -> node_infos ) != NULL &&
821
- !CHECK_FLAG (darr_last (ys -> node_infos )-> schema -> nodetype ,
822
- LYS_CASE | LYS_CHOICE ))
823
- assert (darr_last (ys -> node_infos )-> schema == parent );
821
+ if (last != NULL &&
822
+ !CHECK_FLAG (last -> schema -> nodetype , LYS_CASE | LYS_CHOICE ))
823
+ assert (last -> schema == parent );
824
824
if (darr_lasti (ys -> node_infos ) < ys -> query_base_level )
825
825
return ys -> schema_path [darr_lasti (ys -> node_infos ) + 1 ];
826
826
@@ -908,9 +908,10 @@ static enum nb_error __walk(struct nb_op_yield_state *ys, bool is_resume)
908
908
* Otherwise get the first child of the container we are walking,
909
909
* starting with non-yielding children.
910
910
*/
911
- if (is_resume )
911
+ if (is_resume ) {
912
+ assert (darr_last (ys -> node_infos ) != NULL );
912
913
sib = darr_last (ys -> node_infos )-> schema ;
913
- else {
914
+ } else {
914
915
/*
915
916
* Start with non-yielding children first.
916
917
*
@@ -1477,7 +1478,8 @@ static void nb_op_walk_continue(struct event *thread)
1477
1478
goto finish ;
1478
1479
1479
1480
/* otherwise we are at a resumable node */
1480
- assert (darr_last (ys -> node_infos )-> has_lookup_next );
1481
+ assert (darr_last (ys -> node_infos ) &&
1482
+ darr_last (ys -> node_infos )-> has_lookup_next );
1481
1483
1482
1484
ret = __walk (ys , true);
1483
1485
if (ret == NB_YIELD ) {
0 commit comments