*: use array_size() helper macro

Use the array_size() helper macro.  Replaces several instances of local
macros with the same definition.

Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 431c08e..e3709e0 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -61,7 +61,6 @@
   { .fd = -1, .name = "babeld", .flag = VTYSH_BABELD, .path = BABEL_VTYSH_PATH},
 };
 
-#define VTYSH_INDEX_MAX (sizeof(vtysh_client)/sizeof(vtysh_client[0]))
 
 /* We need direct access to ripd to implement vtysh_exit_ripd_only. */
 static struct vtysh_client *ripd_client = NULL;
@@ -374,7 +373,7 @@
 
 	if (! strcmp(cmd->string,"configure terminal"))
 	  {
-	    for (i = 0; i < VTYSH_INDEX_MAX; i++)
+	    for (i = 0; i < array_size(vtysh_client); i++)
 	      {
 	        cmd_stat = vtysh_client_execute(&vtysh_client[i], line, fp);
 		if (cmd_stat == CMD_WARNING)
@@ -413,7 +412,7 @@
 	  }
 
 	cmd_stat = CMD_SUCCESS;
-	for (i = 0; i < VTYSH_INDEX_MAX; i++)
+	for (i = 0; i < array_size(vtysh_client); i++)
 	  {
 	    if (cmd->daemon & vtysh_client[i].flag)
 	      {
@@ -525,7 +524,7 @@
 	    u_int i;
 	    int cmd_stat = CMD_SUCCESS;
 
-	    for (i = 0; i < VTYSH_INDEX_MAX; i++)
+	    for (i = 0; i < array_size(vtysh_client); i++)
 	      {
 	        if (cmd->daemon & vtysh_client[i].flag)
 		  {
@@ -1354,7 +1353,7 @@
   int ret = CMD_SUCCESS;
   char line[] = "show memory\n";
   
-  for (i = 0; i < VTYSH_INDEX_MAX; i++)
+  for (i = 0; i < array_size(vtysh_client); i++)
     if ( vtysh_client[i].fd >= 0 )
       {
         fprintf (stdout, "Memory statistics for %s:\n", 
@@ -1377,7 +1376,7 @@
   int ret = CMD_SUCCESS;
   char line[] = "show logging\n";
   
-  for (i = 0; i < VTYSH_INDEX_MAX; i++)
+  for (i = 0; i < array_size(vtysh_client); i++)
     if ( vtysh_client[i].fd >= 0 )
       {
         fprintf (stdout,"Logging configuration for %s:\n", 
@@ -1733,7 +1732,7 @@
 	   VTY_NEWLINE);
   vty_out (vty, "!%s", VTY_NEWLINE);
 
-  for (i = 0; i < VTYSH_INDEX_MAX; i++)
+  for (i = 0; i < array_size(vtysh_client); i++)
     ret = vtysh_client_config (&vtysh_client[i], line);
 
   /* Integrate vtysh specific configuration. */
@@ -1807,7 +1806,7 @@
       return CMD_SUCCESS;
     }
 
-  for (i = 0; i < VTYSH_INDEX_MAX; i++)
+  for (i = 0; i < array_size(vtysh_client); i++)
     ret = vtysh_client_config (&vtysh_client[i], line);
 
   vtysh_config_dump (fp);
@@ -1844,7 +1843,7 @@
 
   fprintf (stdout,"Building Configuration...\n");
 	  
-  for (i = 0; i < VTYSH_INDEX_MAX; i++)
+  for (i = 0; i < array_size(vtysh_client); i++)
     ret = vtysh_client_execute (&vtysh_client[i], line, stdout);
   
   fprintf (stdout,"[OK]\n");
@@ -1934,7 +1933,7 @@
 {
   u_int i;
 
-  for (i = 0; i < VTYSH_INDEX_MAX; i++)
+  for (i = 0; i < array_size(vtysh_client); i++)
     if ( vtysh_client[i].fd >= 0 )
       vty_out(vty, " %s", vtysh_client[i].name);
   vty_out(vty, "%s", VTY_NEWLINE);
@@ -2184,7 +2183,7 @@
   int rc = 0;
   int matches = 0;
 
-  for (i = 0; i < VTYSH_INDEX_MAX; i++)
+  for (i = 0; i < array_size(vtysh_client); i++)
     {
       if (!daemon_name || !strcmp(daemon_name, vtysh_client[i].name))
 	{