From 77dcc037764e8a61cfcc7066c29a3d0592c1d38b Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 21 Sep 2017 16:26:58 +0200 Subject: [PATCH] match -> item --- lib/ecoli_completed.c | 28 ++++++++++++++-------------- lib/ecoli_completed.h | 14 +++++++------- lib/ecoli_test.c | 2 +- lib/main-readline.c | 10 +++++----- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/ecoli_completed.c b/lib/ecoli_completed.c index 8f8dc22..71849d1 100644 --- a/lib/ecoli_completed.c +++ b/lib/ecoli_completed.c @@ -188,11 +188,11 @@ ec_completed_node(const struct ec_node *node) return compnode; } -static struct ec_completed_match * -ec_completed_match(enum ec_completed_type type, struct ec_parsed *state, +static struct ec_completed_item * +ec_completed_item(enum ec_completed_type type, struct ec_parsed *state, const struct ec_node *node, const char *add) { - struct ec_completed_match *item = NULL; + struct ec_completed_item *item = NULL; struct ec_parsed *p; size_t len; @@ -229,7 +229,7 @@ fail: ec_free(item->path); ec_free(item->add); } - ec_completed_match_free(item); + ec_completed_item_free(item); return NULL; } @@ -241,7 +241,7 @@ __ec_completed_add_match(enum ec_completed_type type, const struct ec_node *node, const char *add) { struct ec_completed_node *compnode = NULL; - struct ec_completed_match *match = NULL; + struct ec_completed_item *match = NULL; int ret = -ENOMEM; /* find the compnode entry corresponding to this node */ @@ -252,7 +252,7 @@ __ec_completed_add_match(enum ec_completed_type type, if (compnode == NULL) return -ENOENT; - match = ec_completed_match(type, parsed_state, node, add); + match = ec_completed_item(type, parsed_state, node, add); if (match == NULL) goto fail; @@ -265,7 +265,7 @@ __ec_completed_add_match(enum ec_completed_type type, return 0; fail: - ec_completed_match_free(match); + ec_completed_item_free(match); return ret; } @@ -310,7 +310,7 @@ ec_completed_add_node(struct ec_completed *completed, return 0; } -void ec_completed_match_free(struct ec_completed_match *match) +void ec_completed_item_free(struct ec_completed_item *match) { ec_free(match->add); ec_free(match->path); @@ -339,7 +339,7 @@ ec_node_default_complete(const struct ec_node *gen_node, void ec_completed_free(struct ec_completed *completed) { struct ec_completed_node *compnode; - struct ec_completed_match *item; + struct ec_completed_item *item; if (completed == NULL) return; @@ -351,7 +351,7 @@ void ec_completed_free(struct ec_completed *completed) while (!TAILQ_EMPTY(&compnode->matches)) { item = TAILQ_FIRST(&compnode->matches); TAILQ_REMOVE(&compnode->matches, item, next); - ec_completed_match_free(item); + ec_completed_item_free(item); } ec_free(compnode); } @@ -361,7 +361,7 @@ void ec_completed_free(struct ec_completed *completed) void ec_completed_dump(FILE *out, const struct ec_completed *completed) { struct ec_completed_node *compnode; - struct ec_completed_match *item; + struct ec_completed_item *item; if (completed == NULL || completed->count == 0) { fprintf(out, "no completion\n"); @@ -392,7 +392,7 @@ void ec_completed_dump(FILE *out, const struct ec_completed *completed) char *ec_completed_smallest_start(const struct ec_completed *completed) { struct ec_completed_node *compnode; - struct ec_completed_match *item; + struct ec_completed_item *item; char *smallest_start = NULL; size_t n; @@ -456,12 +456,12 @@ ec_completed_iter(struct ec_completed *completed, return iter; } -const struct ec_completed_match *ec_completed_iter_next( +const struct ec_completed_item *ec_completed_iter_next( struct ec_completed_iter *iter) { const struct ec_completed *completed = iter->completed; const struct ec_completed_node *cur_node; - const struct ec_completed_match *cur_match; + const struct ec_completed_item *cur_match; if (completed == NULL) return NULL; diff --git a/lib/ecoli_completed.h b/lib/ecoli_completed.h index d801c3e..33512da 100644 --- a/lib/ecoli_completed.h +++ b/lib/ecoli_completed.h @@ -40,8 +40,8 @@ enum ec_completed_type { EC_PARTIAL_MATCH, }; -struct ec_completed_match { - TAILQ_ENTRY(ec_completed_match) next; +struct ec_completed_item { + TAILQ_ENTRY(ec_completed_item) next; enum ec_completed_type type; const struct ec_node *node; char *add; @@ -51,12 +51,12 @@ struct ec_completed_match { size_t pathlen; }; -TAILQ_HEAD(ec_completed_match_list, ec_completed_match); +TAILQ_HEAD(ec_completed_item_list, ec_completed_item); struct ec_completed_node { TAILQ_ENTRY(ec_completed_node) next; const struct ec_node *node; - struct ec_completed_match_list matches; + struct ec_completed_item_list matches; }; TAILQ_HEAD(ec_completed_node_list, ec_completed_node); @@ -97,7 +97,7 @@ int ec_completed_add_partial_match(struct ec_completed *completed, int ec_completed_add_node(struct ec_completed *completed, const struct ec_node *node); -void ec_completed_match_free(struct ec_completed_match *item); +void ec_completed_item_free(struct ec_completed_item *item); void ec_completed_free(struct ec_completed *completed); void ec_completed_dump(FILE *out, const struct ec_completed *completed); @@ -118,14 +118,14 @@ struct ec_completed_iter { enum ec_completed_type type; const struct ec_completed *completed; const struct ec_completed_node *cur_node; - const struct ec_completed_match *cur_match; + const struct ec_completed_item *cur_match; }; struct ec_completed_iter * ec_completed_iter(struct ec_completed *completed, enum ec_completed_type type); -const struct ec_completed_match *ec_completed_iter_next( +const struct ec_completed_item *ec_completed_iter_next( struct ec_completed_iter *iter); void ec_completed_iter_free(struct ec_completed_iter *iter); diff --git a/lib/ecoli_test.c b/lib/ecoli_test.c index a50529d..070d99b 100644 --- a/lib/ecoli_test.c +++ b/lib/ecoli_test.c @@ -136,7 +136,7 @@ int ec_test_check_complete(struct ec_node *tk, ...) s != EC_NODE_ENDLIST; s = va_arg(ap, const char *)) { struct ec_completed_iter *iter; - const struct ec_completed_match *item; + const struct ec_completed_item *item; if (s == NULL) { ret = -1; diff --git a/lib/main-readline.c b/lib/main-readline.c index b8c2f0b..2d3a39c 100644 --- a/lib/main-readline.c +++ b/lib/main-readline.c @@ -55,7 +55,7 @@ static char *my_completion_entry(const char *s, int state) { static struct ec_completed *c; static struct ec_completed_iter *iter; - static const struct ec_completed_match *item; + static const struct ec_completed_item *item; char *out_string; /* don't append a quote */ @@ -116,7 +116,7 @@ static char **my_attempted_completion(const char *text, int start, int end) } /* this function builds the help string */ -static char *get_node_help(const struct ec_completed_match *elt) +static char *get_node_help(const struct ec_completed_item *item) { const struct ec_node *node; char *help = NULL; @@ -124,8 +124,8 @@ static char *get_node_help(const struct ec_completed_match *elt) const char *node_desc = NULL; size_t i; - for (i = 0; i < elt->pathlen; i++) { - node = elt->path[i]; + for (i = 0; i < item->pathlen; i++) { + node = item->path[i]; if (node_help == NULL) node_help = ec_keyval_get(ec_node_attrs(node), "help"); if (node_desc == NULL) @@ -146,7 +146,7 @@ static char *get_node_help(const struct ec_completed_match *elt) static int show_help(int ignore, int invoking_key) { const struct ec_completed_node *compnode; -// const struct ec_completed_match *item; +// const struct ec_completed_item *item; // struct ec_completed_iter *iter; struct ec_completed *c; struct ec_parsed *p; -- 2.20.1