From: Olivier Matz Date: Thu, 15 Jun 2017 20:25:52 +0000 (+0200) Subject: save X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c1eb3099a1a7f4c9b9f8c6238336ee5b69147fd6;p=protos%2Flibecoli.git save --- diff --git a/lib/ecoli_keyval.c b/lib/ecoli_keyval.c index 0557bff..2572ba0 100644 --- a/lib/ecoli_keyval.c +++ b/lib/ecoli_keyval.c @@ -46,7 +46,7 @@ struct ec_keyval { struct ec_keyval_elt *vec; }; -struct ec_keyval *ec_keyval_new(void) +struct ec_keyval *ec_keyval(void) { struct ec_keyval *keyval; @@ -192,7 +192,7 @@ static int ec_keyval_testcase(void) struct ec_keyval *keyval; char *val; - keyval = ec_keyval_new(); + keyval = ec_keyval(); if (keyval == NULL) { ec_log(EC_LOG_ERR, "cannot create keyval\n"); return -1; diff --git a/lib/ecoli_keyval.h b/lib/ecoli_keyval.h index f0076cf..82fc9e4 100644 --- a/lib/ecoli_keyval.h +++ b/lib/ecoli_keyval.h @@ -34,7 +34,7 @@ typedef void (*ec_keyval_elt_free_t)(void *); struct ec_keyval; -struct ec_keyval *ec_keyval_new(void); +struct ec_keyval *ec_keyval(void); void *ec_keyval_get(const struct ec_keyval *keyval, const char *key); int ec_keyval_del(struct ec_keyval *keyval, const char *key); diff --git a/lib/ecoli_node.c b/lib/ecoli_node.c index c9315fa..da91173 100644 --- a/lib/ecoli_node.c +++ b/lib/ecoli_node.c @@ -72,7 +72,7 @@ void ec_node_type_dump(FILE *out) fprintf(out, "%s\n", type->name); } -struct ec_node *__ec_node_new(const struct ec_node_type *type, const char *id) +struct ec_node *__ec_node(const struct ec_node_type *type, const char *id) { struct ec_node *node = NULL; char buf[256]; // XXX @@ -98,7 +98,7 @@ struct ec_node *__ec_node_new(const struct ec_node_type *type, const char *id) if (node->desc == NULL) goto fail; - node->attrs = ec_keyval_new(); + node->attrs = ec_keyval(); if (node->attrs == NULL) goto fail; @@ -109,7 +109,7 @@ struct ec_node *__ec_node_new(const struct ec_node_type *type, const char *id) return NULL; } -struct ec_node *ec_node_new(const char *typename, const char *id) +struct ec_node *ec_node(const char *typename, const char *id) { struct ec_node_type *type; @@ -119,7 +119,7 @@ struct ec_node *ec_node_new(const char *typename, const char *id) return NULL; } - return __ec_node_new(type, id); + return __ec_node(type, id); } void ec_node_free(struct ec_node *node) @@ -221,7 +221,7 @@ struct ec_parsed *ec_node_parse(struct ec_node *node, const char *str) struct ec_parsed *parsed; errno = ENOMEM; - strvec = ec_strvec_new(); + strvec = ec_strvec(); if (strvec == NULL) goto fail; @@ -269,7 +269,7 @@ struct ec_parsed *ec_node_parse_strvec(struct ec_node *node, } -struct ec_parsed *ec_parsed_new(void) +struct ec_parsed *ec_parsed(void) { struct ec_parsed *parsed = NULL; @@ -429,7 +429,7 @@ size_t ec_parsed_matches(const struct ec_parsed *parsed) return 1; } -struct ec_completed *ec_completed_new(void) +struct ec_completed *ec_completed(void) { struct ec_completed *completed = NULL; @@ -443,7 +443,7 @@ struct ec_completed *ec_completed_new(void) return completed; } -struct ec_completed_elt *ec_completed_elt_new(const struct ec_node *node, +struct ec_completed_elt *ec_completed_elt(const struct ec_node *node, const char *add) { struct ec_completed_elt *elt = NULL; @@ -476,7 +476,7 @@ struct ec_completed *ec_node_complete(struct ec_node *node, struct ec_completed *completed; errno = ENOMEM; - strvec = ec_strvec_new(); + strvec = ec_strvec(); if (strvec == NULL) goto fail; @@ -504,11 +504,11 @@ struct ec_completed *ec_node_default_complete(const struct ec_node *gen_node, (void)strvec; - completed = ec_completed_new(); + completed = ec_completed(); if (completed == NULL) return NULL; - completed_elt = ec_completed_elt_new(gen_node, NULL); + completed_elt = ec_completed_elt(gen_node, NULL); if (completed_elt == NULL) { ec_completed_free(completed); return NULL; @@ -660,7 +660,7 @@ unsigned int ec_completed_count( } struct ec_completed_iter * -ec_completed_iter_new(struct ec_completed *completed, +ec_completed_iter(struct ec_completed *completed, enum ec_completed_filter_flags flags) { struct ec_completed_iter *iter; diff --git a/lib/ecoli_node.h b/lib/ecoli_node.h index ad24a45..0933a20 100644 --- a/lib/ecoli_node.h +++ b/lib/ecoli_node.h @@ -121,10 +121,10 @@ struct ec_node { /* create a new node when the type is known, typically called from the node * code */ -struct ec_node *__ec_node_new(const struct ec_node_type *type, const char *id); +struct ec_node *__ec_node(const struct ec_node_type *type, const char *id); /* create a_new node node */ -struct ec_node *ec_node_new(const char *typename, const char *id); +struct ec_node *ec_node(const char *typename, const char *id); void ec_node_free(struct ec_node *node); @@ -151,7 +151,7 @@ struct ec_parsed { struct ec_strvec *strvec; }; -struct ec_parsed *ec_parsed_new(void); +struct ec_parsed *ec_parsed(void); void ec_parsed_free(struct ec_parsed *parsed); struct ec_node *ec_node_clone(struct ec_node *node); void ec_parsed_free_children(struct ec_parsed *parsed); @@ -213,8 +213,8 @@ struct ec_completed *ec_node_complete(struct ec_node *node, const char *str); struct ec_completed *ec_node_complete_strvec(struct ec_node *node, const struct ec_strvec *strvec); -struct ec_completed *ec_completed_new(void); -struct ec_completed_elt *ec_completed_elt_new(const struct ec_node *node, +struct ec_completed *ec_completed(void); +struct ec_completed_elt *ec_completed_elt(const struct ec_node *node, const char *add); void ec_completed_add_elt(struct ec_completed *completed, struct ec_completed_elt *elt); @@ -247,7 +247,7 @@ struct ec_completed_iter { }; struct ec_completed_iter * -ec_completed_iter_new(struct ec_completed *completed, +ec_completed_iter(struct ec_completed *completed, enum ec_completed_filter_flags flags); const struct ec_completed_elt *ec_completed_iter_next( diff --git a/lib/ecoli_node_cmd.c b/lib/ecoli_node_cmd.c index d1d2c7d..f6afbd2 100644 --- a/lib/ecoli_node_cmd.c +++ b/lib/ecoli_node_cmd.c @@ -273,7 +273,7 @@ static int ec_node_cmd_build(struct ec_node *gen_node) /* build the expression parser */ ret = -ENOMEM; - expr = ec_node_new("expr", "expr"); + expr = ec_node("expr", "expr"); if (expr == NULL) goto fail; ret = ec_node_expr_set_val_node(expr, ec_node_re(NULL, "[a-zA-Z0-9]+")); @@ -338,7 +338,7 @@ static int ec_node_cmd_build(struct ec_node *gen_node) goto fail; ret = -ENOMEM; - cmd = ec_node_new("seq", NULL); + cmd = ec_node("seq", NULL); if (cmd == NULL) goto fail; @@ -417,7 +417,7 @@ struct ec_node *ec_node_cmd(const char *id, const char *cmd_str) struct ec_node *gen_node = NULL; struct ec_node_cmd *node = NULL; - gen_node = __ec_node_new(&ec_node_cmd_type, id); + gen_node = __ec_node(&ec_node_cmd_type, id); if (gen_node == NULL) goto fail; diff --git a/lib/ecoli_node_empty.c b/lib/ecoli_node_empty.c index 186a106..c85d641 100644 --- a/lib/ecoli_node_empty.c +++ b/lib/ecoli_node_empty.c @@ -48,11 +48,11 @@ static struct ec_parsed *ec_node_empty_parse(const struct ec_node *gen_node, (void)strvec; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; - match_strvec = ec_strvec_new(); + match_strvec = ec_strvec(); if (match_strvec == NULL) goto fail; @@ -79,7 +79,7 @@ static int ec_node_empty_testcase(void) struct ec_node *node; int ret = 0; - node = ec_node_new("empty", NULL); + node = ec_node("empty", NULL); if (node == NULL) { ec_log(EC_LOG_ERR, "cannot create node\n"); return -1; @@ -90,7 +90,7 @@ static int ec_node_empty_testcase(void) ec_node_free(node); /* never completes */ - node = ec_node_new("empty", NULL); + node = ec_node("empty", NULL); if (node == NULL) { ec_log(EC_LOG_ERR, "cannot create node\n"); return -1; diff --git a/lib/ecoli_node_expr.c b/lib/ecoli_node_expr.c index f80e3ba..8d2f698 100644 --- a/lib/ecoli_node_expr.c +++ b/lib/ecoli_node_expr.c @@ -125,12 +125,12 @@ static int ec_node_expr_build(struct ec_node *gen_node) /* create the object, we will initialize it later: this is * needed because we have a circular dependency */ ret = -ENOMEM; - weak = ec_node_new("weakref", "weak"); + weak = ec_node("weakref", "weak"); if (weak == NULL) return -1; /* prefix unary operators */ - pre_op = ec_node_new("or", "pre-op"); + pre_op = ec_node("or", "pre-op"); if (pre_op == NULL) goto fail; for (i = 0; i < node->pre_ops_len; i++) { @@ -139,7 +139,7 @@ static int ec_node_expr_build(struct ec_node *gen_node) } /* suffix unary operators */ - post_op = ec_node_new("or", "post-op"); + post_op = ec_node("or", "post-op"); if (post_op == NULL) goto fail; for (i = 0; i < node->post_ops_len; i++) { @@ -147,7 +147,7 @@ static int ec_node_expr_build(struct ec_node *gen_node) goto fail; } - post = ec_node_new("or", "post"); + post = ec_node("or", "post"); if (post == NULL) goto fail; if (ec_node_or_add(post, ec_node_clone(node->val_node)) < 0) diff --git a/lib/ecoli_node_expr_test.c b/lib/ecoli_node_expr_test.c index ac3e5ba..2ce0669 100644 --- a/lib/ecoli_node_expr_test.c +++ b/lib/ecoli_node_expr_test.c @@ -219,7 +219,7 @@ static int ec_node_expr_testcase(void) struct ec_node *node = NULL, *lex_node = NULL; int ret = 0; - node = ec_node_new("expr", "my_expr"); + node = ec_node("expr", "my_expr"); if (node == NULL) return -1; diff --git a/lib/ecoli_node_int.c b/lib/ecoli_node_int.c index 2391b29..8c7be7c 100644 --- a/lib/ecoli_node_int.c +++ b/lib/ecoli_node_int.c @@ -84,7 +84,7 @@ static struct ec_parsed *ec_node_int_parse(const struct ec_node *gen_node, const char *str; long long val; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -123,7 +123,7 @@ struct ec_node *ec_node_int(const char *id, long long int min, struct ec_node *gen_node = NULL; struct ec_node_int *node = NULL; - gen_node = __ec_node_new(&ec_node_int_type, id); + gen_node = __ec_node(&ec_node_int_type, id); if (gen_node == NULL) return NULL; node = (struct ec_node_int *)gen_node; diff --git a/lib/ecoli_node_many.c b/lib/ecoli_node_many.c index 7eb359b..6142b32 100644 --- a/lib/ecoli_node_many.c +++ b/lib/ecoli_node_many.c @@ -56,7 +56,7 @@ static struct ec_parsed *ec_node_many_parse(const struct ec_node *gen_node, struct ec_strvec *childvec = NULL; size_t off = 0, len, count; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -120,7 +120,7 @@ static struct ec_completed *ec_node_many_complete(const struct ec_node *gen_node size_t len = 0; unsigned int i; - completed = ec_completed_new(); + completed = ec_completed(); if (completed == NULL) return NULL; @@ -191,7 +191,7 @@ struct ec_node *ec_node_many(const char *id, struct ec_node *child, if (child == NULL) return NULL; - node = (struct ec_node_many *)__ec_node_new(&ec_node_many_type, id); + node = (struct ec_node_many *)__ec_node(&ec_node_many_type, id); if (node == NULL) { ec_node_free(child); return NULL; diff --git a/lib/ecoli_node_option.c b/lib/ecoli_node_option.c index 39c1004..01665b4 100644 --- a/lib/ecoli_node_option.c +++ b/lib/ecoli_node_option.c @@ -51,7 +51,7 @@ static struct ec_parsed *ec_node_option_parse(const struct ec_node *gen_node, struct ec_parsed *parsed = NULL, *child_parsed; struct ec_strvec *match_strvec; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -64,7 +64,7 @@ static struct ec_parsed *ec_node_option_parse(const struct ec_node *gen_node, match_strvec = ec_strvec_dup(child_parsed->strvec); } else { ec_parsed_free(child_parsed); - match_strvec = ec_strvec_new(); + match_strvec = ec_strvec(); } if (match_strvec == NULL) @@ -112,7 +112,7 @@ struct ec_node *ec_node_option(const char *id, struct ec_node *child) if (child == NULL) return NULL; - gen_node = __ec_node_new(&ec_node_option_type, id); + gen_node = __ec_node(&ec_node_option_type, id); if (gen_node == NULL) { ec_node_free(child); return NULL; diff --git a/lib/ecoli_node_or.c b/lib/ecoli_node_or.c index d1e4863..932b01c 100644 --- a/lib/ecoli_node_or.c +++ b/lib/ecoli_node_or.c @@ -54,7 +54,7 @@ static struct ec_parsed *ec_node_or_parse(const struct ec_node *gen_node, struct ec_strvec *match_strvec; unsigned int i; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -94,7 +94,7 @@ static struct ec_completed *ec_node_or_complete(const struct ec_node *gen_node, struct ec_completed *completed, *child_completed; size_t n; - completed = ec_completed_new(); + completed = ec_completed(); if (completed == NULL) return NULL; @@ -169,7 +169,7 @@ struct ec_node *__ec_node_or(const char *id, ...) va_start(ap, id); - gen_node = __ec_node_new(&ec_node_or_type, id); + gen_node = __ec_node(&ec_node_or_type, id); node = (struct ec_node_or *)gen_node; if (node == NULL) fail = 1;; diff --git a/lib/ecoli_node_re.c b/lib/ecoli_node_re.c index d5c9b49..00bd793 100644 --- a/lib/ecoli_node_re.c +++ b/lib/ecoli_node_re.c @@ -53,7 +53,7 @@ static struct ec_parsed *ec_node_re_parse(const struct ec_node *gen_node, const char *str; regmatch_t pos; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -127,7 +127,7 @@ struct ec_node *ec_node_re(const char *id, const char *re_str) { struct ec_node *gen_node = NULL; - gen_node = __ec_node_new(&ec_node_re_type, id); + gen_node = __ec_node(&ec_node_re_type, id); if (gen_node == NULL) goto fail; diff --git a/lib/ecoli_node_re_lex.c b/lib/ecoli_node_re_lex.c index f580b72..e0e6d00 100644 --- a/lib/ecoli_node_re_lex.c +++ b/lib/ecoli_node_re_lex.c @@ -44,7 +44,7 @@ tokenize(struct regexp_pattern *table, size_t table_len, const char *str) if (dup == NULL) goto fail; - strvec = ec_strvec_new(); + strvec = ec_strvec(); if (strvec == NULL) goto fail; @@ -95,7 +95,7 @@ static struct ec_parsed *ec_node_re_lex_parse(const struct ec_node *gen_node, struct ec_parsed *parsed = NULL, *child_parsed; const char *str; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) return NULL; @@ -211,7 +211,7 @@ struct ec_node *ec_node_re_lex(const char *id, struct ec_node *child) if (child == NULL) return NULL; - node = (struct ec_node_re_lex *)__ec_node_new(&ec_node_re_lex_type, id); + node = (struct ec_node_re_lex *)__ec_node(&ec_node_re_lex_type, id); if (node == NULL) { ec_node_free(child); return NULL; diff --git a/lib/ecoli_node_seq.c b/lib/ecoli_node_seq.c index 11312eb..4a975ad 100644 --- a/lib/ecoli_node_seq.c +++ b/lib/ecoli_node_seq.c @@ -57,7 +57,7 @@ static struct ec_parsed *ec_node_seq_parse(const struct ec_node *gen_node, size_t len = 0; unsigned int i; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -109,7 +109,7 @@ static struct ec_completed *ec_node_seq_complete(const struct ec_node *gen_node, size_t len = 0; unsigned int i; - completed = ec_completed_new(); + completed = ec_completed(); if (completed == NULL) return NULL; @@ -213,7 +213,7 @@ struct ec_node *__ec_node_seq(const char *id, ...) va_start(ap, id); - gen_node = __ec_node_new(&ec_node_seq_type, id); + gen_node = __ec_node(&ec_node_seq_type, id); node = (struct ec_node_seq *)gen_node; if (node == NULL) fail = 1;; diff --git a/lib/ecoli_node_sh_lex.c b/lib/ecoli_node_sh_lex.c index 549faec..d0c5eb2 100644 --- a/lib/ecoli_node_sh_lex.c +++ b/lib/ecoli_node_sh_lex.c @@ -156,7 +156,7 @@ static struct ec_strvec *tokenize(const char *str, int completion, // printf("str=%s\n", str); - strvec = ec_strvec_new(); + strvec = ec_strvec(); if (strvec == NULL) goto fail; @@ -241,7 +241,7 @@ static struct ec_parsed *ec_node_sh_lex_parse(const struct ec_node *gen_node, struct ec_parsed *parsed = NULL, *child_parsed; const char *str; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) return NULL; @@ -292,7 +292,7 @@ static struct ec_completed *ec_node_sh_lex_complete(const struct ec_node *gen_no char missing_quote; // printf("==================\n"); - completed = ec_completed_new(); + completed = ec_completed(); if (completed == NULL) return NULL; @@ -346,7 +346,7 @@ struct ec_node *ec_node_sh_lex(const char *id, struct ec_node *child) if (child == NULL) return NULL; - node = (struct ec_node_sh_lex *)__ec_node_new(&ec_node_sh_lex_type, id); + node = (struct ec_node_sh_lex *)__ec_node(&ec_node_sh_lex_type, id); if (node == NULL) { ec_node_free(child); return NULL; diff --git a/lib/ecoli_node_space.c b/lib/ecoli_node_space.c index 3efce53..db3e9f5 100644 --- a/lib/ecoli_node_space.c +++ b/lib/ecoli_node_space.c @@ -49,7 +49,7 @@ static struct ec_parsed *ec_node_space_parse(const struct ec_node *gen_node, const char *str; size_t len = 0; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -89,7 +89,7 @@ static int ec_node_space_testcase(void) struct ec_node *node; int ret = 0; - node = ec_node_new("space", NULL); + node = ec_node("space", NULL); if (node == NULL) { ec_log(EC_LOG_ERR, "cannot create node\n"); return -1; @@ -102,7 +102,7 @@ static int ec_node_space_testcase(void) ec_node_free(node); /* test completion */ - node = ec_node_new("space", NULL); + node = ec_node("space", NULL); if (node == NULL) { ec_log(EC_LOG_ERR, "cannot create node\n"); return -1; diff --git a/lib/ecoli_node_str.c b/lib/ecoli_node_str.c index c30b9dd..237f0fe 100644 --- a/lib/ecoli_node_str.c +++ b/lib/ecoli_node_str.c @@ -51,7 +51,7 @@ static struct ec_parsed *ec_node_str_parse(const struct ec_node *gen_node, struct ec_parsed *parsed = NULL; const char *str; - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -84,7 +84,7 @@ static struct ec_completed *ec_node_str_complete(const struct ec_node *gen_node, const char *str, *add; size_t n = 0; - completed = ec_completed_new(); + completed = ec_completed(); if (completed == NULL) return NULL; @@ -102,7 +102,7 @@ static struct ec_completed *ec_node_str_complete(const struct ec_node *gen_node, else add = node->string + n; - completed_elt = ec_completed_elt_new(gen_node, add); + completed_elt = ec_completed_elt(gen_node, add); if (completed_elt == NULL) { ec_completed_free(completed); return NULL; @@ -160,7 +160,7 @@ struct ec_node *ec_node_str(const char *id, const char *str) { struct ec_node *gen_node = NULL; - gen_node = __ec_node_new(&ec_node_str_type, id); + gen_node = __ec_node(&ec_node_str_type, id); if (gen_node == NULL) goto fail; diff --git a/lib/ecoli_node_str.h b/lib/ecoli_node_str.h index 611851e..a91acc7 100644 --- a/lib/ecoli_node_str.h +++ b/lib/ecoli_node_str.h @@ -32,8 +32,6 @@ struct ec_node *ec_node_str(const char *id, const char *str); -struct ec_node *ec_node_str_new(const char *id); - /* str is duplicated */ int ec_node_str_set_str(struct ec_node *node, const char *str); diff --git a/lib/ecoli_node_subset.c b/lib/ecoli_node_subset.c index ff9ecca..53790f6 100644 --- a/lib/ecoli_node_subset.c +++ b/lib/ecoli_node_subset.c @@ -165,7 +165,7 @@ static struct ec_parsed *ec_node_subset_parse(const struct ec_node *gen_node, memset(&result, 0, sizeof(result)); - parsed = ec_parsed_new(); + parsed = ec_parsed(); if (parsed == NULL) goto fail; @@ -176,7 +176,7 @@ static struct ec_parsed *ec_node_subset_parse(const struct ec_node *gen_node, /* if no child node matches, return a matching empty strvec */ if (result.parsed_table_len == 0) { ec_free(result.parsed_table); - match_strvec = ec_strvec_new(); + match_strvec = ec_strvec(); if (match_strvec == NULL) goto fail; ec_parsed_set_match(parsed, gen_node, match_strvec); @@ -227,7 +227,7 @@ __ec_node_subset_complete(struct ec_node **table, size_t table_len, * + __subset_complete([a, b], childvec) if c matches */ - completed = ec_completed_new(); + completed = ec_completed(); if (completed == NULL) goto fail; @@ -361,7 +361,7 @@ struct ec_node *__ec_node_subset(const char *id, ...) va_start(ap, id); - gen_node = __ec_node_new(&ec_node_subset_type, id); + gen_node = __ec_node(&ec_node_subset_type, id); node = (struct ec_node_subset *)gen_node; if (node == NULL) fail = 1;; diff --git a/lib/ecoli_node_weakref.c b/lib/ecoli_node_weakref.c index 7370962..7399562 100644 --- a/lib/ecoli_node_weakref.c +++ b/lib/ecoli_node_weakref.c @@ -99,7 +99,7 @@ struct ec_node *ec_node_weakref(const char *id, struct ec_node *child) if (child == NULL) return NULL; - gen_node = __ec_node_new(&ec_node_weakref_type, id); + gen_node = __ec_node(&ec_node_weakref_type, id); if (gen_node == NULL) return NULL; diff --git a/lib/ecoli_strvec.c b/lib/ecoli_strvec.c index 3cc2055..c50f4a6 100644 --- a/lib/ecoli_strvec.c +++ b/lib/ecoli_strvec.c @@ -43,7 +43,7 @@ struct ec_strvec { struct ec_strvec_elt **vec; }; -struct ec_strvec *ec_strvec_new(void) +struct ec_strvec *ec_strvec(void) { struct ec_strvec *strvec; @@ -87,7 +87,7 @@ struct ec_strvec *ec_strvec_ndup(const struct ec_strvec *strvec, size_t off, struct ec_strvec *copy = NULL; size_t i, veclen; - copy = ec_strvec_new(); + copy = ec_strvec(); if (copy == NULL) goto fail; diff --git a/lib/ecoli_strvec.h b/lib/ecoli_strvec.h index d94937b..af1db57 100644 --- a/lib/ecoli_strvec.h +++ b/lib/ecoli_strvec.h @@ -31,7 +31,7 @@ #include #include -struct ec_strvec *ec_strvec_new(void); +struct ec_strvec *ec_strvec(void); int ec_strvec_add(struct ec_strvec *strvec, const char *s); struct ec_strvec *ec_strvec_dup(const struct ec_strvec *strvec); struct ec_strvec *ec_strvec_ndup(const struct ec_strvec *strvec, diff --git a/lib/ecoli_test.c b/lib/ecoli_test.c index b4dd728..134fefa 100644 --- a/lib/ecoli_test.c +++ b/lib/ecoli_test.c @@ -56,7 +56,7 @@ int ec_test_check_parse(struct ec_node *tk, int expected, ...) va_start(ap, expected); /* build a string vector */ - vec = ec_strvec_new(); + vec = ec_strvec(); if (vec == NULL) goto out; @@ -109,7 +109,7 @@ int ec_test_check_complete(struct ec_node *tk, ...) va_start(ap, tk); /* build a string vector */ - vec = ec_strvec_new(); + vec = ec_strvec(); if (vec == NULL) goto out; diff --git a/lib/main-readline.c b/lib/main-readline.c index 9b61903..0fe0672 100644 --- a/lib/main-readline.c +++ b/lib/main-readline.c @@ -71,7 +71,7 @@ static char *my_completion_entry(const char *s, int state) return NULL; ec_completed_iter_free(iter); - iter = ec_completed_iter_new(c, EC_MATCH); + iter = ec_completed_iter(c, EC_MATCH); if (iter == NULL) return NULL; } @@ -146,7 +146,7 @@ static int show_help(int ignore, int invoking_key) if (helps == NULL) return 1; - iter = ec_completed_iter_new(c, EC_MATCH | EC_NO_MATCH); + iter = ec_completed_iter(c, EC_MATCH | EC_NO_MATCH); if (iter == NULL) goto fail; @@ -175,7 +175,7 @@ static int create_commands(void) { struct ec_node *cmdlist = NULL, *cmd = NULL; - cmdlist = ec_node_new("or", NULL); + cmdlist = ec_node("or", NULL); if (cmdlist == NULL) goto fail;