]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/command_match.c
lib, zebra: Add type and instance to nexthop update message
[mirror_frr.git] / lib / command_match.c
index 6384abe5ce838f424f0d40e2e5e7a934818bba7a..f6b07a0b20892d4bac482aa512c20cf109d3729a 100644 (file)
@@ -28,8 +28,6 @@
 
 DEFINE_MTYPE_STATIC(LIB, CMD_MATCHSTACK, "Command Match Stack")
 
-#define MAXDEPTH 256
-
 #ifdef TRACE_MATCHER
 #define TM 1
 #else
@@ -84,7 +82,7 @@ static enum match_type match_mac(const char *, bool);
 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;
 
@@ -200,7 +198,7 @@ static enum matcher_rv command_match_r(struct graph_node *start, vector vline,
        /* 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++)
@@ -333,7 +331,7 @@ static enum matcher_rv command_match_r(struct graph_node *start, vector vline,
                status = MATCHER_INCOMPLETE;
 
        // cleanup
-       list_delete(next);
+       list_delete_and_null(&next);
 
        return status;
 }
@@ -366,7 +364,7 @@ enum matcher_rv command_complete(struct graph *graph, vector vline,
 
        unsigned int idx;
        for (idx = 0; idx < vector_active(vline) && next->count > 0; idx++) {
-               list_delete(current);
+               list_delete_and_null(&current);
                current = next;
                next = list_new();
                next->del = stack_del;
@@ -457,8 +455,8 @@ enum matcher_rv command_complete(struct graph *graph, vector vline,
                }
        }
 
-       list_delete(current);
-       list_delete(next);
+       list_delete_and_null(&current);
+       list_delete_and_null(&next);
 
        return mrv;
 }
@@ -648,7 +646,7 @@ static void del_arglist(struct list *list)
        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 ----------*/