From: Olivier Matz Date: Fri, 18 Aug 2017 20:39:09 +0000 (+0200) Subject: cur_item X-Git-Url: http://git.droids-corp.org/?p=protos%2Flibecoli.git;a=commitdiff_plain;h=4df6dfc41685697b70659cb56b02e3baa61edc73 cur_item --- diff --git a/lib/ecoli_completed.c b/lib/ecoli_completed.c index bec0273..88a8413 100644 --- a/lib/ecoli_completed.c +++ b/lib/ecoli_completed.c @@ -391,7 +391,7 @@ ec_completed_iter(struct ec_completed *completed, iter->completed = completed; iter->type = type; - iter->cur = NULL; + iter->cur_item = NULL; return iter; } @@ -399,29 +399,31 @@ ec_completed_iter(struct ec_completed *completed, const struct ec_completed_item *ec_completed_iter_next( struct ec_completed_iter *iter) { - if (iter->completed == NULL) + const struct ec_completed *completed = iter->completed; + + if (completed == NULL) return NULL; do { - if (iter->cur == NULL) - iter->cur = TAILQ_FIRST(&completed->match_items); + if (iter->cur_item == NULL) + iter->cur_item = TAILQ_FIRST(&completed->match_items); else - iter->cur = TAILQ_NEXT(iter->cur, next); + iter->cur_item = TAILQ_NEXT(iter->cur_item, next); - if (iter->cur == NULL) + if (iter->cur_item == NULL) break; - if (iter->cur->add == NULL && + if (iter->cur_item->add == NULL && (iter->type & EC_NO_MATCH)) break; - if (iter->cur->add != NULL && + if (iter->cur_item->add != NULL && (iter->type & EC_MATCH)) break; - } while (iter->cur != NULL); + } while (iter->cur_item != NULL); - return iter->cur; + return iter->cur_item; } void ec_completed_iter_free(struct ec_completed_iter *iter) diff --git a/lib/ecoli_completed.h b/lib/ecoli_completed.h index ffab287..927bb3e 100644 --- a/lib/ecoli_completed.h +++ b/lib/ecoli_completed.h @@ -104,7 +104,7 @@ unsigned int ec_completed_count( struct ec_completed_iter { enum ec_completed_type type; const struct ec_completed *completed; - const struct ec_completed_item *cur; + const struct ec_completed_item *cur_item; }; struct ec_completed_iter *