From: Olivier Matz Date: Thu, 24 Aug 2017 18:55:52 +0000 (+0200) Subject: x X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=43ded238abb9481d41b28b59ea4c09d98374117a;p=protos%2Flibecoli.git x --- diff --git a/lib/ecoli_completed.c b/lib/ecoli_completed.c index 88a8413..0b0e641 100644 --- a/lib/ecoli_completed.c +++ b/lib/ecoli_completed.c @@ -47,8 +47,8 @@ struct ec_completed *ec_completed(void) if (completed == NULL) return NULL; - TAILQ_INIT(&completed->match_items); - TAILQ_INIT(&completed->no_match_items); + TAILQ_INIT(&completed->nodes); + TAILQ_INIT(&completed->matches); return completed; } @@ -224,7 +224,7 @@ static int ec_completed_add_item(struct ec_completed *completed, completed->count_match++; } - TAILQ_INSERT_TAIL(&completed->match_items, item, next); + TAILQ_INSERT_TAIL(&completed->matches, item, next); completed->count++; return 0; @@ -309,9 +309,9 @@ void ec_completed_merge(struct ec_completed *completed1, assert(completed1 != NULL); assert(completed2 != NULL); - while (!TAILQ_EMPTY(&completed2->match_items)) { - item = TAILQ_FIRST(&completed2->match_items); - TAILQ_REMOVE(&completed2->match_items, item, next); + while (!TAILQ_EMPTY(&completed2->matches)) { + item = TAILQ_FIRST(&completed2->matches); + TAILQ_REMOVE(&completed2->matches, item, next); ec_completed_add_item(completed1, item); } @@ -325,9 +325,9 @@ void ec_completed_free(struct ec_completed *completed) if (completed == NULL) return; - while (!TAILQ_EMPTY(&completed->match_items)) { - item = TAILQ_FIRST(&completed->match_items); - TAILQ_REMOVE(&completed->match_items, item, next); + while (!TAILQ_EMPTY(&completed->matches)) { + item = TAILQ_FIRST(&completed->matches); + TAILQ_REMOVE(&completed->matches, item, next); ec_completed_item_free(item); } ec_free(completed->smallest_start); @@ -347,7 +347,7 @@ void ec_completed_dump(FILE *out, const struct ec_completed *completed) completed->count, completed->count_match, completed->smallest_start); - TAILQ_FOREACH(item, &completed->match_items, next) { + TAILQ_FOREACH(item, &completed->matches, next) { fprintf(out, "add=<%s>, node=%p, node_type=%s\n", item->add, item->node, item->node->type->name); } @@ -406,7 +406,7 @@ const struct ec_completed_item *ec_completed_iter_next( do { if (iter->cur_item == NULL) - iter->cur_item = TAILQ_FIRST(&completed->match_items); + iter->cur_item = TAILQ_FIRST(&completed->matches); else iter->cur_item = TAILQ_NEXT(iter->cur_item, next); diff --git a/lib/ecoli_completed.h b/lib/ecoli_completed.h index 927bb3e..4d0045e 100644 --- a/lib/ecoli_completed.h +++ b/lib/ecoli_completed.h @@ -53,12 +53,18 @@ struct ec_completed_item { TAILQ_HEAD(ec_completed_item_list, ec_completed_item); +struct ec_completed_node { + const struct ec_node *node; +}; + +TAILQ_HEAD(ec_completed_node_list, ec_completed_node); + struct ec_completed { unsigned count; unsigned count_match; char *smallest_start; - struct ec_completed_item_list match_items; - struct ec_completed_item_list no_match_items; + struct ec_completed_node_list nodes; + struct ec_completed_item_list matches; }; /* diff --git a/lib/ecoli_test.c b/lib/ecoli_test.c index a1dc5e7..31f2c37 100644 --- a/lib/ecoli_test.c +++ b/lib/ecoli_test.c @@ -140,7 +140,7 @@ int ec_test_check_complete(struct ec_node *tk, ...) } count++; - TAILQ_FOREACH(item, &c->match_items, next) { + TAILQ_FOREACH(item, &c->matches, next) { /* only check matching completions */ if (item->add != NULL && strcmp(item->add, s) == 0) break;