]> git.droids-corp.org - protos/libecoli.git/commitdiff
cur_item
authorOlivier Matz <zer0@droids-corp.org>
Fri, 18 Aug 2017 20:39:09 +0000 (22:39 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Fri, 18 Aug 2017 20:50:04 +0000 (22:50 +0200)
lib/ecoli_completed.c
lib/ecoli_completed.h

index bec0273219060a685f66b340096d6fabd67215a3..88a841303c94e5a5d70749fda9bdff4efb7d86ea 100644 (file)
@@ -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)
index ffab2872f740433192d1e51b2712334875364cc5..927bb3eb7fef685d234d0ae1049d40a6266967f0 100644 (file)
@@ -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 *