summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2016-09-30 02:16:31 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-09-30 02:16:31 +0200
commit58749582a9a2c5930d907d88a3ad0d0c5c24f627 (patch)
treeca4b5aed981645901812b40478bb0573e0034230 /lib
parentisisd: scrub argc CHECK ME's, refactor general (diff)
downloadfrr-58749582a9a2c5930d907d88a3ad0d0c5c24f627.tar.xz
frr-58749582a9a2c5930d907d88a3ad0d0c5c24f627.zip
all: scrubbed some argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/command.c23
-rw-r--r--lib/filter.c10
-rw-r--r--lib/grammar_sandbox.c12
-rw-r--r--lib/if.c9
-rw-r--r--lib/plist.c10
-rw-r--r--lib/routemap.c6
-rw-r--r--lib/vty.c1
7 files changed, 27 insertions, 44 deletions
diff --git a/lib/command.c b/lib/command.c
index 4be178e12..95d69cdbf 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -1016,7 +1016,6 @@ DEFUN (config_quit,
"quit",
"Exit current mode and down to previous mode\n")
{
- /* CHECK ME argc referenced below */
return config_exit (self, vty, argc, argv);
}
@@ -1138,7 +1137,6 @@ DEFUN (config_write,
"Write configuration currently in memory\n"
"Write configuration to terminal\n")
{
- /* CHECK ME argc referenced below */
int idx_type = 1;
unsigned int i;
int fd;
@@ -1284,7 +1282,6 @@ DEFUN (show_running_config,
SHOW_STR
"running configuration (same as write terminal/memory)\n")
{
- /* CHECK ME argc referenced below */
return config_write (self, vty, argc, argv);
}
@@ -1296,7 +1293,6 @@ DEFUN (copy_runningconf_startupconf,
"Copy running config to... \n"
"Copy running config to startup config (same as write file)\n")
{
- /* CHECK ME argc referenced below */
return config_write (self, vty, argc, argv);
}
/** -- **/
@@ -1378,7 +1374,6 @@ DEFUN (config_password,
"Specifies a HIDDEN password will follow\n"
"The password string\n")
{
- /* CHECK ME argc referenced below */
int idx_8 = 1;
int idx_word = 2;
if (argc == 3) // '8' was specified
@@ -1425,9 +1420,9 @@ DEFUN (config_enable_password,
"dummy string \n"
"The HIDDEN 'enable' password string\n")
{
- /* CHECK ME argc referenced below */
int idx_8 = 2;
int idx_word = 3;
+
/* Crypt type is specified. */
if (argc == 4)
{
@@ -1618,7 +1613,7 @@ DEFUN_HIDDEN (do_echo,
{
char *message;
- vty_out (vty, "%s%s", ((message = argv_concat (argv, argc, 0)) ? message : ""),
+ vty_out (vty, "%s%s", ((message = argv_concat (argv, argc, 1)) ? message : ""),
VTY_NEWLINE);
if (message)
XFREE(MTYPE_TMP, message);
@@ -1632,15 +1627,15 @@ DEFUN (config_logmsg,
LOG_LEVEL_DESC
"The message to send\n")
{
- /* CHECK ME argc referenced below */
int idx_log_level = 1;
+ int idx_message = 2;
int level;
char *message;
if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED)
return CMD_ERR_NO_MATCH;
- zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, 1)) ? message : ""));
+ zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, idx_message)) ? message : ""));
if (message)
XFREE(MTYPE_TMP, message);
return CMD_SUCCESS;
@@ -1706,9 +1701,9 @@ DEFUN (config_log_stdout,
"Set stdout logging level\n"
LOG_LEVEL_DESC)
{
- /* CHECK ME argc referenced below */
int idx_log_level = 2;
- if (argc == 2)
+
+ if (argc == idx_log_level)
{
zlog_set_level (NULL, ZLOG_DEST_STDOUT, zlog_default->default_lvl);
return CMD_SUCCESS;
@@ -1740,9 +1735,9 @@ DEFUN (config_log_monitor,
"Set terminal line (monitor) logging level\n"
LOG_LEVEL_DESC)
{
- /* CHECK ME argc referenced below */
int idx_log_level = 2;
- if (argc == 2)
+
+ if (argc == idx_log_level)
{
zlog_set_level (NULL, ZLOG_DEST_MONITOR, zlog_default->default_lvl);
return CMD_SUCCESS;
@@ -1829,7 +1824,6 @@ DEFUN (config_log_file,
"Logging filename\n"
LOG_LEVEL_DESC)
{
- /* CHECK ME argc referenced below */
int idx_filename = 2;
int idx_log_levels = 3;
if (argc == 4)
@@ -1870,7 +1864,6 @@ DEFUN (config_log_syslog,
"Set syslog logging level\n"
LOG_LEVEL_DESC)
{
- /* CHECK ME argc referenced below */
int idx_log_levels = 2;
if (argc == 3)
{
diff --git a/lib/filter.c b/lib/filter.c
index fd80b2a63..501b28f2d 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -1480,8 +1480,8 @@ DEFUN (access_list_remark,
"Access list entry comment\n"
"Comment up to 100 characters\n")
{
- /* CHECK ME argc referenced below */
int idx_acl = 1;
+ int idx_remark = 3;
struct access_list *access;
access = access_list_get (AFI_IP, argv[idx_acl]->arg);
@@ -1491,7 +1491,7 @@ DEFUN (access_list_remark,
XFREE (MTYPE_TMP, access->remark);
access->remark = NULL;
}
- access->remark = argv_concat(argv, argc, 1);
+ access->remark = argv_concat(argv, argc, idx_remark);
return CMD_SUCCESS;
}
@@ -1526,7 +1526,6 @@ DEFUN (no_access_list_remark_comment,
"Access list entry comment\n"
"Comment up to 100 characters\n")
{
- /* CHECK ME argc referenced below */
return no_access_list_remark (self, vty, argc, argv);
}
@@ -1675,8 +1674,8 @@ DEFUN (ipv6_access_list_remark,
"Access list entry comment\n"
"Comment up to 100 characters\n")
{
- /* CHECK ME argc referenced below */
int idx_word = 2;
+ int idx_line = 4;
struct access_list *access;
access = access_list_get (AFI_IP6, argv[idx_word]->arg);
@@ -1686,7 +1685,7 @@ DEFUN (ipv6_access_list_remark,
XFREE (MTYPE_TMP, access->remark);
access->remark = NULL;
}
- access->remark = argv_concat(argv, argc, 1);
+ access->remark = argv_concat(argv, argc, idx_line);
return CMD_SUCCESS;
}
@@ -1715,7 +1714,6 @@ DEFUN (no_ipv6_access_list_remark_comment,
"Access list entry comment\n"
"Comment up to 100 characters\n")
{
- /* CHECK ME argc referenced below */
return no_ipv6_access_list_remark (self, vty, argc, argv);
}
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 34e0b8106..c4ae2d7d7 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -57,9 +57,9 @@ DEFUN (grammar_test,
GRAMMAR_STR
"command to pass to new parser\n")
{
- /* CHECK ME argc referenced below */
+ int idx_command = 2;
// make a string from tokenized command line
- char *command = argv_concat (argv, argc, 0);
+ char *command = argv_concat (argv, argc, idx_command);
// create cmd_element for parser
struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element));
@@ -81,8 +81,8 @@ DEFUN (grammar_test_complete,
"attempt to complete input on DFA\n"
"command to complete")
{
- /* CHECK ME argc referenced below */
- char *cmdstr = argv_concat (argv, argc, 0);
+ int idx_command = 2;
+ char *cmdstr = argv_concat (argv, argc, idx_command);
vector command = cmd_make_strvec (cmdstr);
// generate completions of user input
@@ -131,11 +131,11 @@ DEFUN (grammar_test_match,
"attempt to match input on DFA\n"
"command to match")
{
- /* CHECK ME argc referenced below */
+ int idx_command = 2;
if (argv[0][0] == '#')
return CMD_SUCCESS;
- char *cmdstr = argv_concat(argv, argc, 0);
+ char *cmdstr = argv_concat(argv, argc, idx_command);
vector command = cmd_make_strvec (cmdstr);
struct list *argvv = NULL;
diff --git a/lib/if.c b/lib/if.c
index 382e69d61..dd8922ee9 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -677,16 +677,13 @@ DEFUN (interface_desc,
"Interface specific description\n"
"Characters describing this interface\n")
{
- /* CHECK ME argc referenced below */
+ int idx_line = 1;
struct interface *ifp;
- if (argc == 1)
- return CMD_SUCCESS;
-
ifp = vty->index;
if (ifp->desc)
XFREE (MTYPE_TMP, ifp->desc);
- ifp->desc = argv_concat(argv, argc, 1);
+ ifp->desc = argv_concat(argv, argc, idx_line);
return CMD_SUCCESS;
}
@@ -910,7 +907,7 @@ DEFUN (show_address,
vrf_id_t vrf_id = VRF_DEFAULT;
if (argc > 2)
- VRF_GET_ID (vrf_id, argv[idx_vrf_cmd_str]->arg);
+ VRF_GET_ID (vrf_id, argv[idx_vrf]->arg);
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp))
{
diff --git a/lib/plist.c b/lib/plist.c
index 4170230d8..23d580bd6 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -1905,8 +1905,8 @@ DEFUN (ip_prefix_list_description,
"Prefix-list specific description\n"
"Up to 80 characters describing this prefix-list\n")
{
- /* CHECK ME argc referenced below */
int idx_word = 2;
+ int idx_line = 4;
struct prefix_list *plist;
plist = prefix_list_get (AFI_IP, 0, argv[idx_word]->arg);
@@ -1916,7 +1916,7 @@ DEFUN (ip_prefix_list_description,
XFREE (MTYPE_TMP, plist->desc);
plist->desc = NULL;
}
- plist->desc = argv_concat(argv, argc, 1);
+ plist->desc = argv_concat(argv, argc, idx_line);
return CMD_SUCCESS;
}
@@ -1945,7 +1945,6 @@ DEFUN (no_ip_prefix_list_description_comment,
"Prefix-list specific description\n"
"Up to 80 characters describing this prefix-list\n")
{
- /* CHECK ME argc referenced below */
return no_ip_prefix_list_description (self, vty, argc, argv);
}
@@ -2618,8 +2617,8 @@ DEFUN (ipv6_prefix_list_description,
"Prefix-list specific description\n"
"Up to 80 characters describing this prefix-list\n")
{
- /* CHECK ME argc referenced below */
int idx_word = 2;
+ int iddx_line = 4;
struct prefix_list *plist;
plist = prefix_list_get (AFI_IP6, 0, argv[idx_word]->arg);
@@ -2629,7 +2628,7 @@ DEFUN (ipv6_prefix_list_description,
XFREE (MTYPE_TMP, plist->desc);
plist->desc = NULL;
}
- plist->desc = argv_concat(argv, argc, 1);
+ plist->desc = argv_concat(argv, argc, iddx_line);
return CMD_SUCCESS;
}
@@ -2658,7 +2657,6 @@ DEFUN (no_ipv6_prefix_list_description_comment,
"Prefix-list specific description\n"
"Up to 80 characters describing this prefix-list\n")
{
- /* CHECK ME argc referenced below */
return no_ipv6_prefix_list_description_comment (self, vty, argc, argv);
}
diff --git a/lib/routemap.c b/lib/routemap.c
index b3d349d2f..2e8637bcb 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -1606,7 +1606,6 @@ DEFUN (rmap_continue,
"Continue on a different entry within the route-map\n"
"Route-map entry sequence number\n")
{
- /* CHECK ME argc referenced below */
return rmap_onmatch_goto (self, vty, argc, argv);
}
@@ -1618,7 +1617,6 @@ DEFUN (no_rmap_continue,
"Continue on a different entry within the route-map\n"
"Route-map entry sequence number\n")
{
- /* CHECK ME argc referenced below */
return no_rmap_onmatch_goto (self, vty, argc, argv);
}
@@ -1693,7 +1691,7 @@ DEFUN (rmap_description,
"Route-map comment\n"
"Comment describing this route-map rule\n")
{
- /* CHECK ME argc referenced below */
+ int idx_line = 1;
struct route_map_index *index;
index = vty->index;
@@ -1701,7 +1699,7 @@ DEFUN (rmap_description,
{
if (index->description)
XFREE (MTYPE_TMP, index->description);
- index->description = argv_concat (argv, argc, 1);
+ index->description = argv_concat (argv, argc, idx_line);
}
return CMD_SUCCESS;
}
diff --git a/lib/vty.c b/lib/vty.c
index 301af667e..5a4f0fcbe 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2948,7 +2948,6 @@ DEFUN (no_terminal_monitor,
"Set terminal line parameters\n"
"Copy debug output to the current terminal line\n")
{
- /* CHECK ME argc referenced below */
return terminal_no_monitor (self, vty, argc, argv);
}