DEFINE_MTYPE_STATIC(LIB, CMD_MATCHSTACK, "Command Match Stack")
-#define MAXDEPTH 256
-
#ifdef TRACE_MATCHER
#define TM 1
#else
enum matcher_rv command_match(struct graph *cmdgraph, vector vline,
struct list **argv, const struct cmd_element **el)
{
- struct graph_node *stack[MAXDEPTH];
+ struct graph_node *stack[CMD_ARGC_MAX];
enum matcher_rv status;
*argv = NULL;
/* 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)
+ if (n == CMD_ARGC_MAX)
return MATCHER_NO_MATCH;
if (!token->allowrepeat)
for (size_t s = 0; s < n; s++)
status = MATCHER_INCOMPLETE;
// cleanup
- list_delete(next);
+ list_delete_and_null(&next);
return status;
}
unsigned int idx;
for (idx = 0; idx < vector_active(vline) && next->count > 0; idx++) {
- list_delete(current);
+ list_delete_and_null(¤t);
current = next;
next = list_new();
next->del = stack_del;
}
}
- list_delete(current);
- list_delete(next);
+ list_delete_and_null(¤t);
+ list_delete_and_null(&next);
return mrv;
}
list_delete_node(list, tail);
// delete the rest of the list as usual
- list_delete(list);
+ list_delete_and_null(&list);
}
/*---------- token level matching functions ----------*/