Make table have external linkage to bodge around deficiency in C. The
authormdw <mdw>
Sun, 8 Oct 2000 12:10:32 +0000 (12:10 +0000)
committermdw <mdw>
Sun, 8 Oct 2000 12:10:32 +0000 (12:10 +0000)
problem is that @static gen generators[];@ is considered to be a
`tentative definition', and therefore mustn't have incomplete type,
which it obviously has.

rspit.c

diff --git a/rspit.c b/rspit.c
index 4622d90..57a27ca 100644 (file)
--- a/rspit.c
+++ b/rspit.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: rspit.c,v 1.10 2000/08/11 21:34:59 mdw Exp $
+ * $Id: rspit.c,v 1.11 2000/10/08 12:10:32 mdw Exp $
  *
  * Spit out random numbers
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: rspit.c,v $
+ * Revision 1.11  2000/10/08 12:10:32  mdw
+ * Make table have external linkage to bodge around deficiency in C.  The
+ * problem is that @static gen generators[];@ is considered to be a
+ * `tentative definition', and therefore mustn't have incomplete type,
+ * which it obviously has.
+ *
  * Revision 1.10  2000/08/11 21:34:59  mdw
  * New restartable interface to Maurer testing.
  *
@@ -157,7 +163,7 @@ typedef struct gen {
   const char *help;
 } gen;
 
-static gen generators[];
+extern gen generators[];
 
 #define CIPHERS                                                                \
   E(DES, des)                                                          \
@@ -1069,7 +1075,7 @@ static grand *gen_opts(unsigned i)
 
 /*----- Generators table --------------------------------------------------*/
 
-static gen generators[] = {
+gen generators[] = {
   { "fibonacci",       gen_fib,        0,
     "[-s SEED]" },
   { "lc",              gen_lc,         0,
@@ -1083,12 +1089,12 @@ static gen generators[] = {
   { #pre "-counter",   gen_counter,    CIPHER_##PRE,                   \
     "[-k KEY-PHRASE] [-H HEX-KEY] [-i HEX-IV]" },
   CIPHERS
-#undef E(PRE, pre)
+#undef E
 #define E(PRE, pre)                                                    \
   { #pre "-mgf",       gen_mgf,        HASH_##PRE,                     \
     "[-k KEY-PHRASE] [-H HEX-KEY] [-i INDEX]" },
   HASHES
-#undef E(PRE, pre)
+#undef E
   { "rc4",             gen_rc4,        0,
     "[-k KEY-PHRASE] [-H HEX-KEY]" },
   { "seal",            gen_seal,       0,
@@ -1298,7 +1304,7 @@ int main(int ac, char *av[])
   if (argc > 1 && *argv[1] != '-') {
     const char *arg = av[1];
     size_t sz = strlen(arg);
-    gen *gg;
+    gen *gg = 0;
 
     g = 0;
     for (gg = generators; gg->name; gg++) {