add some const
authorOlivier Matz <zer0@droids-corp.org>
Thu, 1 Mar 2018 20:19:54 +0000 (21:19 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Thu, 1 Mar 2018 20:19:54 +0000 (21:19 +0100)
lib/ecoli_completed.c
lib/ecoli_completed.h
lib/ecoli_parsed.c
lib/ecoli_parsed.h

index 089a2c7..0159797 100644 (file)
@@ -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;
index 191c443..9eed0cb 100644 (file)
@@ -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);
 
index 7423be5..54bed70 100644 (file)
@@ -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;
index 175e1cb..340c23e 100644 (file)
@@ -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);