]> git.puffer.fish Git - mirror/frr.git/commitdiff
all: scrubbed some argc CHECK MEs
authorDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 29 Sep 2016 19:51:56 +0000 (19:51 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 29 Sep 2016 19:51:56 +0000 (19:51 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
14 files changed:
isisd/isis_redist.c
isisd/isis_routemap.c
isisd/isis_te.c
isisd/isis_vty.c
lib/distribute.c
lib/if.c
lib/routemap.c
lib/thread.c
lib/vty.c
pimd/pim_cmd.c
ripd/rip_interface.c
ripd/rip_routemap.c
ripngd/ripng_routemap.c
vtysh/vtysh.c

index 038fba77e02883a077d1f3d356b793eeaa6085ab..7cd3027f16aa14883b6d034f1da4d0afef34f7e3 100644 (file)
@@ -618,7 +618,6 @@ DEFUN (no_isis_redistribute,
        "Redistribute into level-1\n"
        "Redistribute into level-2\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_afi = 2;
   int idx_protocol = 3;
   int idx_level = 4;
@@ -628,9 +627,6 @@ DEFUN (no_isis_redistribute,
   int family;
   int afi;
 
-  if (argc < 3)
-    return CMD_WARNING;
-
   family = str2family(argv[idx_afi]->arg);
   if (family < 0)
     return CMD_WARNING;
@@ -669,7 +665,6 @@ DEFUN (isis_default_originate,
        "Route map reference\n"
        "Pointer to route-map entries\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_afi = 2;
   int idx_level = 3;
   int idx_metric_rmap = 4;
@@ -680,9 +675,6 @@ DEFUN (isis_default_originate,
   unsigned long metric;
   const char *routemap;
 
-  if (argc < 5)
-    return CMD_WARNING;
-
   family = str2family(argv[idx_afi]->arg);
   if (family < 0)
     return CMD_WARNING;
@@ -741,7 +733,6 @@ DEFUN (no_isis_default_originate,
        "Distribute default route into level-1\n"
        "Distribute default route into level-2\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_afi = 3;
   int idx_level = 4;
   struct isis_area *area = vty->index;
@@ -749,9 +740,6 @@ DEFUN (no_isis_default_originate,
   int family;
   int level;
 
-  if (argc < 2)
-    return CMD_WARNING;
-
   family = str2family(argv[idx_afi]->arg);
   if (family < 0)
     return CMD_WARNING;
index 6d130d08d935a8033c56bd019c587a40edde9c1e..a1f087548f4dd906c87c597a0ebfc70ba31e0f50 100644 (file)
@@ -370,7 +370,6 @@ DEFUN (no_match_ip_address,
        "IP access-list number (expanded range)\n"
        "IP Access-list name\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_acl = 4;
   if (argc <= idx_acl)
     return isis_route_match_delete(vty, vty->index, "ip address", NULL);
@@ -404,7 +403,6 @@ DEFUN (no_match_ip_address_prefix_list,
        "Match entries of prefix-lists\n"
        "IP prefix-list name\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_word = 5;
   if (argc <= idx_word)
     return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL);
@@ -436,7 +434,6 @@ DEFUN (no_match_ipv6_address,
        "Match IPv6 address of route\n"
        "IPv6 access-list name\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_word = 4;
   if (argc <= idx_word)
     return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL);
@@ -469,7 +466,6 @@ DEFUN (no_match_ipv6_address_prefix_list,
        "Match entries of prefix-lists\n"
        "IP prefix-list name\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_word = 5;
   if (argc <= idx_word)
     return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL);
@@ -501,7 +497,6 @@ DEFUN (no_set_metric,
       "Metric value for destination routing protocol\n"
       "Metric value\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_number = 3;
   if (argc <= idx_number)
     return isis_route_set_delete(vty, vty->index, "metric", NULL);
index 2a5122a9de3885d60a7d18c35e9bc3f5ad8cabfe..95abf223105b986e642492e5993859a602fb05c6 100644 (file)
@@ -1318,13 +1318,12 @@ DEFUN (show_isis_mpls_te_interface,
        "Interface information\n"
        "Interface name\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_interface = 4;
   struct interface *ifp;
   struct listnode *node;
 
   /* Show All Interfaces. */
-  if (argc == 0)
+  if (argc == 4)
     {
       for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
         show_mpls_te_sub (vty, ifp);
index 91a7e2bde8423cd04f6a3a7929ca6529c7d67601..a1970a9017e0e58666034f17f897ef3ff3c5f050 100644 (file)
@@ -2067,7 +2067,6 @@ DEFUN (area_passwd_md5,
        "Send but do not check PDUs on receiving\n"
        "Send and check PDUs on receiving\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_password = 0;
   int idx_word = 2;
   int idx_type = 5;
@@ -2098,7 +2097,6 @@ DEFUN (area_passwd_clear,
        "Send but do not check PDUs on receiving\n"
        "Send and check PDUs on receiving\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_password = 0;
   int idx_word = 2;
   int idx_type = 5;
index e0b4f0468a1bf69202a8155a5921bd609466bd21..8a00833915025edd5ad59038a6b31e22820eb7c7 100644 (file)
@@ -308,7 +308,6 @@ DEFUN (distribute_list,
        "Filter outgoing routing updates\n"
        "Interface name\n")
 {
-  /* CHECK ME argc referenced below */
   int prefix = (argv[1]->type == WORD_TKN) ? 1 : 0;
 
   /* Check of distribute list type. */
@@ -340,7 +339,6 @@ DEFUN (no_distribute_list,
        "Filter outgoing routing updates\n"
        "Interface name\n")
 {
-  /* CHECK ME argc referenced below */
   int prefix = (argv[2]->type == WORD_TKN) ? 1 : 0;
 
   /* Check of distribute list type. */
index 7b55a327cb1f2ce8bec74098d3814a0d8341c05d..382e69d61c993f90c35b757f318426c0f84bf111 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -756,10 +756,10 @@ DEFUN (interface,
        "Interface's name\n"
        VRF_CMD_HELP_STR)
 {
-  /* CHECK ME argc referenced below */
   int idx_ifname = 1;
+  int idx_vrf = 3;
   const char *ifname = argv[idx_ifname]->arg;
-  const char *vrfname = (argc > 2) ? argv[3]->arg : NULL;
+  const char *vrfname = (argc > 2) ? argv[idx_vrf]->arg : NULL;
 
   struct interface *ifp;
   size_t sl;
@@ -901,8 +901,7 @@ DEFUN (show_address,
        "address\n"
        VRF_CMD_HELP_STR)
 {
-  /* CHECK ME argc referenced below */
-  int idx_vrf_cmd_str = 2;
+  int idx_vrf = 3;
   struct listnode *node;
   struct listnode *node2;
   struct interface *ifp;
index 2b4ec0c67a0bf88663714c0d987b6a01df92f6c8..b3d349d2f85341ba60c528b2bebeefb8691d2c0d 100644 (file)
@@ -1544,13 +1544,9 @@ DEFUN (rmap_onmatch_goto,
        "Goto Clause number\n"
        "Number\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_number = 2;
   char *num = NULL;
-  if (!strcmp (argv[0]->text, "continue"))
-    num = argv[1]->arg;
-  else
-    num = argv[idx_number]->arg;
+  num = argv[idx_number]->arg;
 
   struct route_map_index *index = vty->index;
   int d = 0;
@@ -1565,7 +1561,7 @@ DEFUN (rmap_onmatch_goto,
          return CMD_WARNING;
         }
 
-      if (argc == 1 && num)
+      if (num)
         VTY_GET_INTEGER_RANGE("route-map index", d, num, 1, 65535);
       else
         d = index->pref + 1;
@@ -1634,10 +1630,9 @@ DEFUN (rmap_show_name,
        "route-map information\n"
        "route-map name\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_word = 2;
-    const char *name = (argc == 3) ? argv[idx_word]->arg : NULL;
-    return vty_show_route_map (vty, name);
+  const char *name = (argc == 3) ? argv[idx_word]->arg : NULL;
+  return vty_show_route_map (vty, name);
 }
 
 DEFUN (rmap_call,
index eb85d57af0530277db28010da75f871a1464dc93..76acd0778902bac7dc5ec29b0f3e8409f1b7bfde 100644 (file)
@@ -299,7 +299,6 @@ DEFUN (show_thread_cpu,
        "Thread CPU usage\n"
        "Display filter (rwtexb)\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_filter = 3;
   int i = 0;
   thread_type filter = (thread_type) -1U;
@@ -383,7 +382,6 @@ DEFUN (clear_thread_cpu,
        "Thread CPU usage\n"
        "Display filter (rwtexb)\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_filter = 3;
   int i = 0;
   thread_type filter = (thread_type) -1U;
index 7fcf4565a2a115acc2877e5ca63557281494150a..301af667e1e32cc20d7d45a008df04d77a5d74c3 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2797,10 +2797,9 @@ DEFUN (no_vty_access_class,
        "Filter connections based on an IP access list\n"
        "IP access list\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_word = 2;
   const char *accesslist = (argc == 3) ? argv[idx_word]->arg : NULL;
-  if (! vty_accesslist_name || (argc && strcmp(vty_accesslist_name, accesslist)))
+  if (! vty_accesslist_name || (argc == 3 && strcmp(vty_accesslist_name, accesslist)))
     {
       vty_out (vty, "Access-class is not currently applied to vty%s",
                VTY_NEWLINE);
@@ -2841,12 +2840,11 @@ DEFUN (no_vty_ipv6_access_class,
        "Filter connections based on an IP access list\n"
        "IPv6 access list\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_word = 3;
   const char *accesslist = (argc == 4) ? argv[idx_word]->arg : NULL;
 
   if (! vty_ipv6_accesslist_name ||
-      (argc && strcmp(vty_ipv6_accesslist_name, accesslist)))
+      (argc == 4 && strcmp(vty_ipv6_accesslist_name, accesslist)))
     {
       vty_out (vty, "IPv6 access-class is not currently applied to vty%s",
                VTY_NEWLINE);
index bf68e3a51e1ba3f1eb1652433b5226802093b507..5f2dcefdc8f5340e0cfb627a580dc4912458f534 100644 (file)
@@ -2534,11 +2534,10 @@ DEFUN (ip_ssmpingd,
        CONF_SSMPINGD_STR
        "Source address\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_ipv4 = 2;
   int result;
   struct in_addr source_addr;
-  const char *source_str = (argc > 0) ? argv[idx_ipv4]->arg : "0.0.0.0";
+  const char *source_str = (argc > idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0";
 
   result = inet_pton(AF_INET, source_str, &source_addr);
   if (result <= 0) {
@@ -2565,11 +2564,10 @@ DEFUN (no_ip_ssmpingd,
        CONF_SSMPINGD_STR
        "Source address\n")
 {
-  /* CHECK ME argc referenced below */
   int idx_ipv4 = 3;
   int result;
   struct in_addr source_addr;
-  const char *source_str = (argc > 0) ? argv[idx_ipv4]->arg : "0.0.0.0";
+  const char *source_str = (argc > idx_ipv4) ? argv[idx_ipv4]->arg : "0.0.0.0";
 
   result = inet_pton(AF_INET, source_str, &source_addr);
   if (result <= 0) {
@@ -3562,7 +3560,6 @@ DEFUN (interface_ip_pim_hello,
        IFACE_PIM_HELLO_TIME_STR
        IFACE_PIM_HELLO_HOLD_STR)
 {
-  /* CHECK ME argc referenced below */
   int idx_time = 3;
   int idx_hold = 4;
   struct interface *ifp;
index 6b2fef7f509471213204c211958a77d2aab86e1b..d6686399c2e5b5e7684c08dfe87f15d78cb7f487 100644 (file)
@@ -1528,7 +1528,6 @@ DEFUN (ip_rip_authentication_mode,
        "RFC compatible\n"
        "Old ripd compatible\n")
 {
-  /* CHECK ME argc referenced below */
   char *cryptmode = argv[4]->text;
   char *authlen = (argc > 5) ? argv[6]->text : NULL;
   struct interface *ifp;
index e43c398c49ca10947368742fe7c0b54b2e9a78bd..e1017cfb2741b2ed91785f51a2ac549b7b5b8bff 100644 (file)
@@ -754,7 +754,6 @@ DEFUN (no_match_metric,
        "Match metric of route\n"
        "Metric value\n")
 {
-  /* CHECK ME argc referenced below */
   char *mval = (argc == 4) ? argv[3]->arg : NULL;
   return rip_route_match_delete (vty, vty->index, "metric", mval);
 }
@@ -779,7 +778,6 @@ DEFUN (no_match_interface,
        "Match first hop interface of route\n"
        "Interface name\n")
 {
-  /* CHECK ME argc referenced below */
   char *iface = (argc == 4) ? argv[3]->arg : NULL;
   return rip_route_match_delete (vty, vty->index, "interface", iface);
 }
@@ -809,7 +807,6 @@ DEFUN (no_match_ip_next_hop,
        "IP access-list number (expanded range)\n"
        "IP Access-list name\n")
 {
-  /* CHECK ME argc referenced below */
   char *al = (argc == 5) ? argv[4]->arg : NULL;
   return rip_route_match_delete (vty, vty->index, "ip next-hop", al);
 }
@@ -837,7 +834,6 @@ DEFUN (no_match_ip_next_hop_prefix_list,
        "Match entries of prefix-lists\n"
        "IP prefix-list name\n")
 {
-  /* CHECK ME argc referenced below */
   char *plist = (argc == 6) ? argv[5]->arg : NULL;
   return rip_route_match_delete (vty, vty->index, "ip next-hop prefix-list", plist);
 }
@@ -869,7 +865,6 @@ DEFUN (no_match_ip_address,
        "IP access-list number (expanded range)\n"
        "IP Access-list name\n")
 {
-  /* CHECK ME argc referenced below */
   char *al = (argc == 5) ? argv[4]->arg : NULL;
   return rip_route_match_delete (vty, vty->index, "ip address", al);
 }
@@ -898,7 +893,6 @@ DEFUN (no_match_ip_address_prefix_list,
        "Match entries of prefix-lists\n"
        "IP prefix-list name\n")
 {
-  /* CHECK ME argc referenced below */
   char *plist = (argc == 6) ? argv[5]->arg : NULL;
   return rip_route_match_delete (vty, vty->index, "ip address prefix-list", plist);
 }
@@ -923,7 +917,6 @@ DEFUN (no_match_tag,
        "Match tag of route\n"
        "Metric value\n")
 {
-  /* CHECK ME argc referenced below */
   char *mval = (argc == 4) ? argv[3]->arg : NULL;
   return rip_route_match_delete (vty, vty->index, "tag", mval);
 }
@@ -996,7 +989,6 @@ DEFUN (no_set_ip_nexthop,
        "Next hop address\n"
        "IP address of next hop\n")
 {
-  /* CHECK ME argc referenced below */
   char *addr = (argc == 5) ? argv[4]->arg : NULL;
   return rip_route_set_delete (vty, vty->index, "ip next-hop", addr);
 }
@@ -1021,7 +1013,6 @@ DEFUN (no_set_tag,
        "Tag value for routing protocol\n"
        "Tag value\n")
 {
-  /* CHECK ME argc referenced below */
   char *tag = (argc == 4) ? argv[3]->arg : NULL;
   return rip_route_set_delete (vty, vty->index, "tag", tag);
 }
index 52aae9affcde2ed42d2c7abc6201a8d78754516d..6ecf08466043971ad8c1ce94e731041939d7fa94 100644 (file)
@@ -519,7 +519,6 @@ DEFUN (no_match_metric,
        "Match metric of route\n"
        "Metric value\n")
 {
-  /* CHECK ME argc referenced below */
   char *mval = (argc == 4) ? argv[3]->arg : NULL;
   return ripng_route_match_delete (vty, vty->index, "metric", mval);
 }
@@ -544,7 +543,6 @@ DEFUN (no_match_interface,
        "Match first hop interface of route\n"
        "Interface name\n")
 {
-  /* CHECK ME argc referenced below */
   char *iface = (argc == 4) ? argv[3]->arg : NULL;
   return ripng_route_match_delete (vty, vty->index, "interface", iface);
 }
@@ -569,7 +567,6 @@ DEFUN (no_match_tag,
        "Match tag of route\n"
        "Metric value\n")
 {
-  /* CHECK ME argc referenced below */
   char *mval = (argc == 4) ? argv[3]->arg : NULL;
   return ripng_route_match_delete (vty, vty->index, "tag", mval);
 }
@@ -596,7 +593,6 @@ DEFUN (no_set_metric,
        "Metric value for destination routing protocol\n"
        "Metric value\n")
 {
-  /* CHECK ME argc referenced below */
   char *mval = (argc == 4) ? argv[3]->arg : NULL;
   return ripng_route_set_delete (vty, vty->index, "metric", mval);
 }
@@ -641,7 +637,6 @@ DEFUN (no_set_ipv6_nexthop_local,
        "IPv6 local address\n"
        "IPv6 address of next hop\n")
 {
-  /* CHECK ME argc referenced below */
   char *addr = (argc == 6) ? argv[5]->arg : NULL;
   return ripng_route_set_delete (vty, vty->index, "ipv6 next-hop local", addr);
 }
@@ -666,7 +661,6 @@ DEFUN (no_set_tag,
        "Tag value for routing protocol\n"
        "Tag value\n")
 {
-  /* CHECK ME argc referenced below */
   char *tag = (argc == 4) ? argv[3]->arg : NULL;
   return ripng_route_set_delete (vty, vty->index, "tag", tag);
 }
index 44985adbf0b6f010cc7ca5519ef52ce33a97c82a..09f761a3f79fa0dbc7edffa4dc452987fae69960 100644 (file)
@@ -1732,12 +1732,12 @@ DEFUN (vtysh_show_thread,
       "Thread CPU usage\n"
       "Display filter (rwtexb)\n")
 {
-  /* CHECK ME argc referenced below */
+  int idx_filter = 3;
   unsigned int i;
   int ret = CMD_SUCCESS;
   char line[100];
 
-  sprintf(line, "show thread cpu %s\n", (argc == 1) ? argv[0] : "");
+  sprintf(line, "show thread cpu %s\n", (argc == 4) ? argv[idx_filter] : "");
   for (i = 0; i < array_size(vtysh_client); i++)
     if ( vtysh_client[i].fd >= 0 )
       {