]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: remove misleading copy/del_cmd_element
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 23 Nov 2016 11:06:34 +0000 (12:06 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 1 Dec 2016 17:45:30 +0000 (18:45 +0100)
struct cmd_element items are static global variables, they are never
allocated, copied or freed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/command.c
lib/command.h
lib/command_parse.y

index 3ad0ca92d7f87e1bff19db75cac3bfabcd7ffa25..85053aaa8a50de3cd253b99b6729546d01721d77 100644 (file)
@@ -2445,27 +2445,6 @@ copy_cmd_token (struct cmd_token *token)
   return copy;
 }
 
-void
-del_cmd_element(struct cmd_element *cmd)
-{
-  if (!cmd) return;
-  free ((char *) cmd->string);
-  free ((char *) cmd->doc);
-  free (cmd);
-}
-
-struct cmd_element *
-copy_cmd_element(const struct cmd_element *cmd)
-{
-  struct cmd_element *el = XMALLOC(MTYPE_CMD_TOKENS, sizeof (struct cmd_element));
-  el->string = cmd->string ? XSTRDUP(MTYPE_CMD_TOKENS, cmd->string) : NULL;
-  el->func = cmd->func;
-  el->doc = cmd->doc ? XSTRDUP(MTYPE_CMD_TOKENS, cmd->doc) : NULL;
-  el->daemon = cmd->daemon;
-  el->attr = cmd->attr;
-  return el;
-}
-
 void
 cmd_terminate ()
 {
index c9b3440b029f8f8181e62c68ef90a29cce42762e..ba6fd9b7b038cbc90f83ae95e87b509712d5e408 100644 (file)
@@ -417,12 +417,6 @@ extern void cmd_terminate (void);
 extern void cmd_exit (struct vty *vty);
 extern int cmd_list_cmds (struct vty *vty, int do_permute);
 
-/* memory management for cmd_element */
-void
-del_cmd_element(struct cmd_element *);
-struct cmd_element *
-copy_cmd_element(const struct cmd_element *cmd);
-
 /* memory management for cmd_token */
 struct cmd_token *
 new_cmd_token (enum cmd_token_type, u_char attr, char *, char *);
index d084ddd73f41e64d9e4aaa4a43424c6e3eb5649f..a5e582c73b5031c1ebfe1db51b922ad312ac26dd 100644 (file)
@@ -458,7 +458,7 @@ terminate_graph (struct parser_ctx *ctx, struct graph_node *finalnode)
                     strdup (CMD_CR_TEXT),
                     strdup (""));
   struct graph_node *end_element_node =
-    graph_new_node (ctx->graph, element, (void (*)(void *)) &del_cmd_element);
+    graph_new_node (ctx->graph, element, NULL);
 
   if (node_adjacent (finalnode, end_token_node))
     cmd_yyerror (ctx, "Duplicate command.");