cmdline: add the incomplete token string as an argument of iter_start()
[libcmdline.git] / src / genconf / parse_confnode.c
index 21ccaac..033e45d 100644 (file)
@@ -187,7 +187,9 @@ static struct confnode *get_next_node(struct confnode *start,
 }
 
 static int
-complete_conf_node_start(cmdline_parse_token_hdr_t *tk, void **opaque)
+complete_conf_node_start(cmdline_parse_token_hdr_t *tk,
+                        __attribute__((unused)) const char *tokstr,
+                        void **opaque)
 {
        struct token_conf_node *tk2 = (struct token_conf_node *)tk;
        struct token_conf_node_data *tkd = &tk2->conf_node_data;
@@ -199,6 +201,7 @@ complete_conf_node_start(cmdline_parse_token_hdr_t *tk, void **opaque)
        cb = malloc(sizeof(*cb));
        if (cb == NULL)
                return -1;
+       *opaque = cb;
 
        n = get_next_node(*tkd->cur, NULL, flags, mask);
        if (n == NULL)
@@ -206,7 +209,6 @@ complete_conf_node_start(cmdline_parse_token_hdr_t *tk, void **opaque)
 
        cb->start = *tkd->cur;
        cb->cur = n;
-       *opaque = cb;
        return 0;
 }