summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-09-22 20:26:07 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-09-22 20:26:07 +0000
commit97e5b7c0b3b7794d98caa1f40927defb751e637c (patch)
treeeb4528301413c2ffa56a768621082d127e37c721 /lib/command.c
parentaa1c90a4872b2884e18d3e3ba0c160d327d72f78 (diff)
lib: argv fixes, XFREE -> free, rm decl in matcher
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/command.c b/lib/command.c
index 9cdf0a5ff0..680d32b03e 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -2005,13 +2005,13 @@ DEFUN (banner_motd_file,
"Banner from a file\n"
"Filename\n")
{
- int cmd = cmd_banner_motd_file (argv[3]->arg);
+ const char *filename = argv[3]->arg;
+ int cmd = cmd_banner_motd_file (filename);
if (cmd == CMD_ERR_NO_FILE)
- vty_out (vty, "%s does not exist", argv[3]->arg);
+ vty_out (vty, "%s does not exist", filename);
else if (cmd == CMD_WARNING)
- vty_out (vty, "%s must be in %s",
- argv[0], SYSCONFDIR);
+ vty_out (vty, "%s must be in %s", filename, SYSCONFDIR);
return cmd;
}
@@ -2230,20 +2230,19 @@ del_cmd_token (struct cmd_token *token)
if (!token) return;
if (token->text)
- XFREE (MTYPE_CMD_TOKENS, token->text);
+ free (token->text);
if (token->desc)
- XFREE (MTYPE_CMD_TOKENS, token->desc);
+ free (token->desc);
if (token->arg)
- XFREE (MTYPE_CMD_TOKENS, token->arg);
+ free (token->arg);
- XFREE (MTYPE_CMD_TOKENS, token);
+ free (token);
}
struct cmd_token *
copy_cmd_token (struct cmd_token *token)
{
struct cmd_token *copy = new_cmd_token (token->type, NULL, NULL);
- copy->value = token->value;
copy->max = token->max;
copy->min = token->min;
copy->text = token->text ? XSTRDUP (MTYPE_CMD_TOKENS, token->text) : NULL;
@@ -2257,9 +2256,9 @@ void
del_cmd_element(struct cmd_element *cmd)
{
if (!cmd) return;
- XFREE (MTYPE_CMD_TOKENS, cmd->string);
- XFREE (MTYPE_CMD_TOKENS, cmd->doc);
- XFREE (MTYPE_CMD_TOKENS, cmd);
+ free ((char *) cmd->string);
+ free ((char *) cmd->doc);
+ free (cmd);
}
struct cmd_element *