summaryrefslogtreecommitdiffstats
path: root/lib/command_match.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-12-16 17:19:37 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2016-12-16 20:42:01 +0100
commit4d94b2929671e9251e95e6d2f88da8797a1d6e1e (patch)
tree62f7fbb95edac618a4e4b4520642907004842fac /lib/command_match.c
parentbgpd: shuffle qobj_init() (diff)
downloadfrr-4d94b2929671e9251e95e6d2f88da8797a1d6e1e.tar.xz
frr-4d94b2929671e9251e95e6d2f88da8797a1d6e1e.zip
lib: parser: move allowrepeat to cmd_token
struct graph_node isn't quite the right place to control matcher behaviour. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command_match.c')
-rw-r--r--lib/command_match.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/command_match.c b/lib/command_match.c
index b6897109a..62905a4f7 100644
--- a/lib/command_match.c
+++ b/lib/command_match.c
@@ -202,20 +202,20 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n,
{
assert (n < vector_active (vline));
+ // get the minimum match level that can count as a full match
+ struct cmd_token *token = start->data;
+ enum match_type minmatch = min_match_level (token->type);
+
/* check history/stack of tokens
* this disallows matching the same one more than once if there is a
* circle in the graph (used for keyword arguments) */
if (n == MAXDEPTH)
return NULL;
- if (!start->allowrepeat)
+ if (!token->allowrepeat)
for (size_t s = 0; s < n; s++)
if (stack[s] == start)
return NULL;
- // get the minimum match level that can count as a full match
- struct cmd_token *token = start->data;
- enum match_type minmatch = min_match_level (token->type);
-
// get the current operating input token
char *input_token = vector_slot (vline, n);
@@ -481,7 +481,8 @@ add_nexthops (struct list *list, struct graph_node *node,
{
child = vector_slot (node->to, i);
size_t j;
- if (!child->allowrepeat)
+ struct cmd_token *token = child->data;
+ if (!token->allowrepeat)
{
for (j = 0; j < stackpos; j++)
if (child == stack[j])
@@ -489,7 +490,6 @@ add_nexthops (struct list *list, struct graph_node *node,
if (j != stackpos)
continue;
}
- struct cmd_token *token = child->data;
switch (token->type)
{
case OPTION_TKN: