Deploy the new <ctype.h> and `foocmp' macros from mLib.
[catacomb] / symm / strobe.c
index 8d4d42d..de4dbb2 100644 (file)
@@ -468,6 +468,7 @@ void strobe_ratchet(strobe_ctx *ctx, unsigned f, size_t sz)
 #include <string.h>
 
 #include <mLib/hex.h>
+#include <mLib/macros.h>
 #include <mLib/testrig.h>
 
 #define NSTATE 16
@@ -487,7 +488,7 @@ static void dump(int rc, char win, const void *p, size_t sz)
     else putchar('-');
   } else {
     for (i = 0, printable = 1; i < sz; i++)
-      if (!isprint((unsigned char)q[i])) { printable = 0; break; }
+      if (!ISPRINT(q[i])) { printable = 0; break; }
     if (printable)
       printf("`%s'", q);
     else {
@@ -601,7 +602,7 @@ static int verify(dstr v[])
   /* Next job is to parse the command and flags. */
   q = v[1].buf; p = q; q += strcspn(q, "/"); if (*q) *q++ = 0;
   for (op = optab; op->name; op++)
-    if (!strcmp(op->name, p)) goto found_op;
+    if (STRCMP(op->name, ==, p)) goto found_op;
   abort();
 found_op:
 
@@ -654,7 +655,7 @@ found_op:
   rc = op->op(ctx, f, src, dest, sz);
 
   /* Check we got the right answer. */
-  ok = (rc == rcref && (!destref || !memcmp(dest, destref, sz)));
+  ok = (rc == rcref && (!destref || MEMCMP(dest, ==, destref, sz)));
   if (!ok) {
     printf("failed test\n");
     printf("       state = %d\n", r);