From 1a8c390d4abc7c3f599813ddee6ca3990de7576c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 1 Aug 2016 17:03:39 +0000 Subject: lib: Fixed bad node copy, modified token regex When building argv for matched command, only the last node was being copied to argv; the rest were added by reference. Additionally the regex for certain tokens was too restrictive and disallowed characters allowed by the old parser; these have been reinstated. Signed-off-by: Quentin Young --- lib/command_graph.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'lib/command_graph.c') diff --git a/lib/command_graph.c b/lib/command_graph.c index 3e52f42598..e8f72db19e 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -88,29 +88,12 @@ new_node(enum graph_node_type type) return node; } -struct graph_node * -copy_node (struct graph_node *node) -{ - struct graph_node *new = new_node(node->type); - new->children = NULL; - new->is_start = node->is_start; - new->end = node->end; - new->text = node->text ? XSTRDUP(MTYPE_CMD_TOKENS, node->text) : NULL; - new->value = node->value; - new->min = node->min; - new->max = node->max; - new->element = node->element ? copy_cmd_element(node->element) : NULL; - new->arg = node->arg ? XSTRDUP(MTYPE_CMD_TOKENS, node->arg) : NULL; - new->refs = 0; - return new; -} - void free_node (struct graph_node *node) { if (!node) return; - vector_free (node->children); - free_cmd_element (node->element); + if (node->children) vector_free (node->children); + if (node->element) free_cmd_element (node->element); free (node->text); free (node->arg); free (node); -- cgit v1.2.3