+ /* first call */
+ if (cur_node == NULL) {
+ TAILQ_FOREACH(cur_node, &completed->nodes, next) {
+ TAILQ_FOREACH(cur_match, &cur_node->items, next) {
+ if (cur_match != NULL &&
+ cur_match->type & iter->type)
+ goto found;
+ }
+ }
+ return NULL;
+ } else {
+ cur_match = TAILQ_NEXT(cur_match, next);
+ if (cur_match != NULL &&
+ cur_match->type & iter->type)
+ goto found;
+ cur_node = TAILQ_NEXT(cur_node, next);
+ while (cur_node != NULL) {
+ cur_match = TAILQ_FIRST(&cur_node->items);
+ if (cur_match != NULL &&
+ cur_match->type & iter->type)
+ goto found;
+ cur_node = TAILQ_NEXT(cur_node, next);
+ }
+ return NULL;
+ }