*: 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/lib/log.c b/lib/log.c
index cbc935b..e4ec7c2 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -443,8 +443,8 @@
 #define LOC s,buf+sizeof(buf)-s
 
 #ifdef HAVE_GLIBC_BACKTRACE
-  if (((size = backtrace(array,sizeof(array)/sizeof(array[0]))) <= 0) ||
-      ((size_t)size > sizeof(array)/sizeof(array[0])))
+  if (((size = backtrace(array,array_size(array)) <= 0) ||
+      ((size_t)size > array_size(array))))
     return;
 
 #define DUMP(FD) { \
@@ -526,12 +526,12 @@
   int size, i;
   char **strings;
 
-  if (((size = backtrace(array,sizeof(array)/sizeof(array[0]))) <= 0) ||
-      ((size_t)size > sizeof(array)/sizeof(array[0])))
+  if (((size = backtrace(array,array_size(array))) <= 0) ||
+      ((size_t)size > array_size(array)))
     {
       zlog_err("Cannot get backtrace, returned invalid # of frames %d "
 	       "(valid range is between 1 and %lu)",
-	       size, (unsigned long)(sizeof(array)/sizeof(array[0])));
+	       size, (unsigned long)(array_size(array)));
       return;
     }
   zlog(NULL, priority, "Backtrace for %d stack frames:", size);
@@ -636,7 +636,7 @@
   zl->syslog_options = syslog_flags;
 
   /* Set default logging levels. */
-  for (i = 0; i < sizeof(zl->maxlvl)/sizeof(zl->maxlvl[0]); i++)
+  for (i = 0; i < array_size(zl->maxlvl); i++)
     zl->maxlvl[i] = ZLOG_DISABLED;
   zl->maxlvl[ZLOG_DEST_MONITOR] = LOG_DEBUG;
   zl->default_lvl = LOG_DEBUG;
@@ -855,14 +855,14 @@
 {
   u_int i;
 
-  if (zroute >= sizeof(route_types)/sizeof(route_types[0]))
+  if (zroute >= array_size(route_types))
     {
       zlog_err("unknown zebra route type: %u", zroute);
       return &unknown;
     }
   if (zroute == route_types[zroute].type)
     return &route_types[zroute];
-  for (i = 0; i < sizeof(route_types)/sizeof(route_types[0]); i++)
+  for (i = 0; i < array_size(route_types); i++)
     {
       if (zroute == route_types[i].type)
         {
@@ -890,7 +890,7 @@
 const char *
 zserv_command_string (unsigned int command)
 {
-  if (command >= sizeof(command_types)/sizeof(command_types[0]))
+  if (command >= array_size(command_types))
     {
       zlog_err ("unknown zserv command type: %u", command);
       return unknown.string;
@@ -898,21 +898,17 @@
   return command_types[command].string;
 }
 
-#define RTSIZE	(sizeof(route_types)/sizeof(route_types[0]))
-
 int
 proto_name2num(const char *s)
 {
    unsigned i;
 
-   for (i=0; i<RTSIZE; ++i)
+   for (i=0; i<array_size(route_types); ++i)
      if (strcasecmp(s, route_types[i].string) == 0)
        return route_types[i].type;
    return -1;
 }
 
-#undef RTSIZE
-
 int
 proto_redistnum(int afi, const char *s)
 {