*: 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/buffer.c b/lib/buffer.c
index f19a9e0..45e2e1c 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -262,7 +262,7 @@
   /* For erase and more data add two to b's buffer_data count.*/
   if (b->head->next == NULL)
     {
-      iov_alloc = sizeof(small_iov)/sizeof(small_iov[0]);
+      iov_alloc = array_size(small_iov);
       iov = small_iov;
     }
   else
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)
 {
diff --git a/lib/sigevent.c b/lib/sigevent.c
index 30e9a3d..7d08fd9 100644
--- a/lib/sigevent.c
+++ b/lib/sigevent.c
@@ -22,6 +22,7 @@
 #include <zebra.h>
 #include <sigevent.h>
 #include <log.h>
+#include <memory.h>
 
 #ifdef SA_SIGINFO
 #ifdef HAVE_UCONTEXT_H
@@ -266,13 +267,13 @@
 #endif
 		   );
   } sigmap[] = {
-    { core_signals, sizeof(core_signals)/sizeof(core_signals[0]), core_handler},
-    { exit_signals, sizeof(exit_signals)/sizeof(exit_signals[0]), exit_handler},
-    { ignore_signals, sizeof(ignore_signals)/sizeof(ignore_signals[0]), NULL},
+    { core_signals, array_size(core_signals), core_handler},
+    { exit_signals, array_size(exit_signals), exit_handler},
+    { ignore_signals, array_size(ignore_signals), NULL},
   };
   u_int i;
 
-  for (i = 0; i < sizeof(sigmap)/sizeof(sigmap[0]); i++)
+  for (i = 0; i < array_size(sigmap); i++)
     {
       u_int j;
 
diff --git a/lib/sigevent.h b/lib/sigevent.h
index 62b944a..248fa2c 100644
--- a/lib/sigevent.h
+++ b/lib/sigevent.h
@@ -27,7 +27,6 @@
 #include <thread.h>
 
 #define QUAGGA_SIGNAL_TIMER_INTERVAL 2L
-#define Q_SIGC(sig) (sizeof(sig)/sizeof(sig[0]))
 
 struct quagga_signal_t
 {