From 5e9475117ca093c59443af4fe4dea5caa45ae6c3 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Thu, 1 Mar 2018 21:19:54 +0100 Subject: [PATCH] add some const --- lib/ecoli_completed.c | 6 +++--- lib/ecoli_completed.h | 6 +++--- lib/ecoli_parsed.c | 9 +++++---- lib/ecoli_parsed.h | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/ecoli_completed.c b/lib/ecoli_completed.c index 089a2c7..0159797 100644 --- a/lib/ecoli_completed.c +++ b/lib/ecoli_completed.c @@ -84,7 +84,7 @@ struct ec_parsed *ec_completed_get_state(struct ec_completed *completed) } int -ec_node_complete_child(/* XXX const */struct ec_node *node, +ec_node_complete_child(const struct ec_node *node, struct ec_completed *completed, const struct ec_strvec *strvec) { @@ -125,7 +125,7 @@ ec_node_complete_child(/* XXX const */struct ec_node *node, return 0; } -struct ec_completed *ec_node_complete_strvec(struct ec_node *node, +struct ec_completed *ec_node_complete_strvec(const struct ec_node *node, const struct ec_strvec *strvec) { struct ec_completed *completed = NULL; @@ -146,7 +146,7 @@ fail: return NULL; } -struct ec_completed *ec_node_complete(struct ec_node *node, +struct ec_completed *ec_node_complete(const struct ec_node *node, const char *str) { struct ec_strvec *strvec = NULL; diff --git a/lib/ecoli_completed.h b/lib/ecoli_completed.h index 191c443..9eed0cb 100644 --- a/lib/ecoli_completed.h +++ b/lib/ecoli_completed.h @@ -77,13 +77,13 @@ struct ec_completed { * return a completed object filled with items * return NULL on error (nomem?) */ -struct ec_completed *ec_node_complete(struct ec_node *node, +struct ec_completed *ec_node_complete(const struct ec_node *node, const char *str); -struct ec_completed *ec_node_complete_strvec(struct ec_node *node, +struct ec_completed *ec_node_complete_strvec(const struct ec_node *node, const struct ec_strvec *strvec); /* internal: used by nodes */ -int ec_node_complete_child(struct ec_node *node, +int ec_node_complete_child(const struct ec_node *node, struct ec_completed *completed, const struct ec_strvec *strvec); diff --git a/lib/ecoli_parsed.c b/lib/ecoli_parsed.c index 7423be5..54bed70 100644 --- a/lib/ecoli_parsed.c +++ b/lib/ecoli_parsed.c @@ -58,7 +58,8 @@ struct ec_parsed { struct ec_keyval *attrs; }; -static int __ec_node_parse_child(struct ec_node *node, struct ec_parsed *state, +static int __ec_node_parse_child(const struct ec_node *node, + struct ec_parsed *state, bool is_root, const struct ec_strvec *strvec) { struct ec_strvec *match_strvec; @@ -99,14 +100,14 @@ static int __ec_node_parse_child(struct ec_node *node, struct ec_parsed *state, return ret; } -int ec_node_parse_child(struct ec_node *node, struct ec_parsed *state, +int ec_node_parse_child(const struct ec_node *node, struct ec_parsed *state, const struct ec_strvec *strvec) { assert(state != NULL); return __ec_node_parse_child(node, state, false, strvec); } -struct ec_parsed *ec_node_parse_strvec(struct ec_node *node, +struct ec_parsed *ec_node_parse_strvec(const struct ec_node *node, const struct ec_strvec *strvec) { struct ec_parsed *parsed = ec_parsed(node); @@ -124,7 +125,7 @@ struct ec_parsed *ec_node_parse_strvec(struct ec_node *node, return parsed; } -struct ec_parsed *ec_node_parse(struct ec_node *node, const char *str) +struct ec_parsed *ec_node_parse(const struct ec_node *node, const char *str) { struct ec_strvec *strvec = NULL; struct ec_parsed *parsed = NULL; diff --git a/lib/ecoli_parsed.h b/lib/ecoli_parsed.h index 175e1cb..340c23e 100644 --- a/lib/ecoli_parsed.h +++ b/lib/ecoli_parsed.h @@ -92,14 +92,14 @@ const struct ec_strvec *ec_parsed_strvec(const struct ec_parsed *parsed); * * */ -struct ec_parsed *ec_node_parse(struct ec_node *node, const char *str); +struct ec_parsed *ec_node_parse(const struct ec_node *node, const char *str); /** * * * */ -struct ec_parsed *ec_node_parse_strvec(struct ec_node *node, +struct ec_parsed *ec_node_parse_strvec(const struct ec_node *node, const struct ec_strvec *strvec); /** @@ -124,7 +124,7 @@ struct ec_parsed *ec_node_parse_strvec(struct ec_node *node, * the number of matched strings in strvec * XXX state is not freed on error ? */ -int ec_node_parse_child(struct ec_node *node, +int ec_node_parse_child(const struct ec_node *node, struct ec_parsed *state, const struct ec_strvec *strvec); -- 2.39.5