chiark / gitweb /
@@@ tty mess
[mLib] / struct / t / sym-test.c
index dfc2391220e1562bfb79fbf2311cc58d96e99159..5bbbff80d09b5ac60bda69108e4646ac8d038e1f 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "macros.h"
 #include "sym.h"
+#include "unihash.h"
 
 typedef struct word {
   sym_base _b;
@@ -57,6 +58,9 @@ int main(void)
        puts("*MISSING*");
     } else if (STRCMP(p, ==, "count")) {
       printf("%lu\n", (unsigned long)n);
+    } else if (STRCMP(p, ==, "seed")) {
+      char *k = strtok(0, " ");
+      unihash_setkey(&unihash_global, strtoul(k, 0, 0));
     } else if (STRCMP(p, ==, "show")) {
       sym_iter i;
       word *w;
@@ -65,7 +69,7 @@ int main(void)
       if (!n)
        puts("*EMPTY*");
       else {
-       v = malloc(n * sizeof(*v));
+       v = calloc(n, sizeof(*v));
        if (!v) {
          puts("*NOMEM*");
          continue;