{
struct ec_comp *comp = NULL;
struct ec_strvec *strvec = NULL;
- struct ec_comp_iter *iter = NULL;
struct ec_comp_item *item = NULL;
size_t count;
count = ec_comp_count(comp, EC_COMP_UNKNOWN | EC_COMP_FULL |
EC_COMP_PARTIAL);
- iter = ec_comp_iter(comp,
- EC_COMP_UNKNOWN | EC_COMP_FULL | EC_COMP_PARTIAL);
- if (iter == NULL)
- goto fail;
-
- while ((item = ec_comp_iter_next(iter)) != NULL) {
-
+ EC_COMP_FOREACH(item, comp, EC_COMP_UNKNOWN | EC_COMP_FULL |
+ EC_COMP_PARTIAL) {
/* only one match, display it fully */
if (count == 1) {
printf("%s\n", ec_comp_item_get_str(item));
printf("%s\n", ec_comp_item_get_display(item));
}
- ec_comp_iter_free(iter);
ec_comp_free(comp);
ec_strvec_free(strvec);
return 0;