* src/makeint.h: Add an ARRAYLEN macro to compute array sizes

* src/main.c: Replace inline array length computation with ARRAYLEN.
* src/function.c: Ditto.
* src/read.h: Ditto.
diff --git a/src/function.c b/src/function.c
index 00686f3..5e7285a 100644
--- a/src/function.c
+++ b/src/function.c
@@ -2436,8 +2436,6 @@
   FT_ENTRY ("not",           0,  1,  1,  func_not),
 #endif
 };
-
-#define FUNCTION_TABLE_ENTRIES (sizeof (function_table_init) / sizeof (struct function_table_entry))
 
 
 /* These must come after the definition of function_table.  */
@@ -2736,9 +2734,9 @@
 void
 hash_init_function_table (void)
 {
-  hash_init (&function_table, FUNCTION_TABLE_ENTRIES * 2,
+  hash_init (&function_table, ARRAYLEN (function_table_init) * 2,
              function_table_entry_hash_1, function_table_entry_hash_2,
              function_table_entry_hash_cmp);
   hash_load (&function_table, function_table_init,
-             FUNCTION_TABLE_ENTRIES, sizeof (struct function_table_entry));
+             ARRAYLEN (function_table_init), sizeof (struct function_table_entry));
 }
diff --git a/src/main.c b/src/main.c
index 0e7c53a..c9c64b5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2898,10 +2898,8 @@
 
 /* Parsing of arguments, decoding of switches.  */
 
-static char options[1 + sizeof (switches) / sizeof (switches[0]) * 3];
-static struct option long_options[(sizeof (switches) / sizeof (switches[0])) +
-                                  (sizeof (long_option_aliases) /
-                                   sizeof (long_option_aliases[0]))];
+static char options[1 + ARRAYLEN (switches) * 3];
+static struct option long_options[ARRAYLEN (switches) + ARRAYLEN (long_option_aliases)];
 
 /* Fill in the string and vector for getopt.  */
 static void
@@ -2956,9 +2954,7 @@
         }
     }
   *p = '\0';
-  for (c = 0; c < (sizeof (long_option_aliases) /
-                   sizeof (long_option_aliases[0]));
-       ++c)
+  for (c = 0; c < ARRAYLEN (long_option_aliases); ++c)
     long_options[i++] = long_option_aliases[c];
   long_options[i].name = 0;
 }
diff --git a/src/makeint.h b/src/makeint.h
index 6907b2b..00289b9 100644
--- a/src/makeint.h
+++ b/src/makeint.h
@@ -506,6 +506,9 @@
 
 #define NILF ((floc *)0)
 
+/* Number of elements in an array.  */
+#define ARRAYLEN(_a)          (sizeof (_a) / sizeof ((_a)[0]))
+
 /* Number of characters in a string constant.  Does NOT include the \0 byte.  */
 #define CSTRLEN(_s)           (sizeof (_s)-1)
 
diff --git a/src/read.c b/src/read.c
index 3302063..e97d306 100644
--- a/src/read.c
+++ b/src/read.c
@@ -2964,7 +2964,7 @@
   int disable = 0;
 
   /* Compute the number of pointers we need in the table.  */
-  idx = sizeof (default_include_directories) / sizeof (const char *);
+  idx = ARRAYLEN (default_include_directories);
   if (arg_dirs)
     for (cpp = arg_dirs; *cpp != 0; ++cpp)
       ++idx;