tmpl_attr_t const *ar;
tmpl_dcursor_nested_t *ns;
fr_pair_t *iter = curr, *vp;
+ bool pop = false;
ns = fr_dlist_tail(&cc->nested);
ar = ns->ar;
* Get the first instance
*/
case NUM_UNSPEC:
- tmpl_cursor_nested_pop(cc);
+ pop = true;
break;
/*
case NUM_ALL:
case NUM_COUNT:
all_inst:
- if (!vp) tmpl_cursor_nested_pop(cc); /* pop only when we're done */
+ if (!vp) pop = true; /* pop only when we're done */
fr_dcursor_next(&ns->cursor);
break;
while ((iter = fr_dcursor_next(&ns->cursor))) {
vp = iter;
}
- tmpl_cursor_nested_pop(cc);
+ pop = true;
break;
/*
int16_t i = 0;
while ((i++ < ar->num) && vp) vp = fr_dcursor_next(&ns->cursor);
- tmpl_cursor_nested_pop(cc);
+ pop = true;
}
break;
} else goto all_inst; /* Used for TMPL_TYPE_LIST */
break;
}
+ if (pop) tmpl_cursor_nested_pop(cc);
+
return vp;
}