From: Quentin Young Date: Thu, 22 Sep 2016 20:26:07 +0000 (+0000) Subject: lib: argv fixes, XFREE -> free, rm decl in matcher X-Git-Tag: frr-3.0-branchpoint~129^2~195 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=97e5b7c0b3b7794d98caa1f40927defb751e637c;p=matthieu%2Ffrr.git lib: argv fixes, XFREE -> free, rm decl in matcher Signed-off-by: Quentin Young --- 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 * diff --git a/lib/command_match.c b/lib/command_match.c index 03efa93e04..aa961d3514 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -77,9 +77,6 @@ match_range (struct cmd_token *, const char *); static enum match_type match_word (struct cmd_token *, const char *); -static enum match_type -match_number (struct cmd_token *, const char *); - static enum match_type match_variable (struct cmd_token *, const char *);