Deploy the new <ctype.h> and `foocmp' macros from mLib.
[catacomb] / math / mptext.c
index c902264..a5c77db 100644 (file)
@@ -31,6 +31,8 @@
 #include <limits.h>
 #include <stdio.h>
 
+#include <mLib/macros.h>
+
 #include "mp.h"
 #include "mptext.h"
 #include "paranoia.h"
@@ -340,10 +342,10 @@ mp *mp_read(mp *m, int radix, const mptext_ops *ops, void *p)
   /* --- If we're reading text, skip leading space, and maybe a sign --- */
 
   if (radix >= 0) {
-    while (isspace(ch)) ch = ops->get(p);
+    while (ISSPACE(ch)) ch = ops->get(p);
     switch (ch) {
       case '-': f |= f_neg; /* and on */
-      case '+': do ch = ops->get(p); while (isspace(ch));
+      case '+': do ch = ops->get(p); while (ISSPACE(ch));
     }
   }
 
@@ -705,7 +707,7 @@ static int verify(dstr *v)
       ok = 0;
     } else {
       mp_writedstr(m, &d, ob);
-      if (d.len != v[3].len || memcmp(d.buf, v[3].buf, d.len) != 0) {
+      if (d.len != v[3].len || MEMCMP(d.buf, !=, v[3].buf, d.len)) {
        fprintf(stderr, "*** failed read or write\n"
                        "*** input [%2i]      = ", ib);
        if (ib < 0)
@@ -746,7 +748,7 @@ static int verify(dstr *v)
   }
 
   if (v[1].len - off != v[4].len ||
-      memcmp(v[1].buf + off, v[4].buf, v[4].len) != 0) {
+      MEMCMP(v[1].buf + off, !=, v[4].buf, v[4].len)) {
     fprintf(stderr, "*** leftovers incorrect\n"
                    "*** input [%2i]    = ", ib);
     if (ib < 0)