DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command desc")
-#define MAXDEPTH 64
-
/** headers **/
void grammar_sandbox_init(void);
void pretty_print_graph(struct vty *vty, struct graph_node *, int, int,
{
check_nodegraph();
- struct graph_node *stack[MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
pretty_print_graph(vty, vector_slot(nodegraph->nodes, 0), 0, argc >= 3,
stack, 0);
return CMD_SUCCESS;
{
check_nodegraph();
- struct graph_node *stack[MAXDEPTH];
- struct graph_node *visited[MAXDEPTH * MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
+ struct graph_node *visited[CMD_ARGC_MAX * CMD_ARGC_MAX];
size_t vpos = 0;
FILE *ofd = fopen(argv[2]->arg, "w");
return;
}
- if (++stackpos == MAXDEPTH)
+ if (++stackpos == CMD_ARGC_MAX)
return;
for (i = 0; i < vector_active(gn->to); i++) {
static struct list *cmd_graph_permutations(struct graph *graph)
{
char accumulate[2048] = "";
- struct graph_node *stack[MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
struct list *rv = list_new();
rv->cmp = cmd_permute_cmp;
nodegraph = cnode->cmdgraph;
if (!nodegraph)
continue;
- vty_out(vty, "scanning node %d (%s)\n",
- scannode - 1, node_names[scannode - 1]);
+ vty_out(vty, "scanning node %d (%s)\n", scannode - 1,
+ node_names[scannode - 1]);
}
commands = cmd_graph_permutations(nodegraph);
vty_out(vty, " ?'%s'", tok->desc);
vty_out(vty, " ");
- if (stackpos == MAXDEPTH) {
+ if (stackpos == CMD_ARGC_MAX) {
vty_out(vty, " -aborting! (depth limit)\n");
return;
}
if (visited[i] == start)
return;
visited[(*visitpos)++] = start;
- if ((*visitpos) == MAXDEPTH * MAXDEPTH)
+ if ((*visitpos) == CMD_ARGC_MAX * CMD_ARGC_MAX)
return;
snprintf(tokennum, sizeof(tokennum), "%d?", tok->type);
}
fprintf(ofd, ">, style = filled, fillcolor = \"%s\" ];\n", color);
- if (stackpos == MAXDEPTH)
+ if (stackpos == CMD_ARGC_MAX)
return;
stack[stackpos++] = start;