Deploy the new <ctype.h> and `foocmp' macros from mLib.
[catacomb] / key / key-io.c
index bf3bf95..3bb8e1d 100644 (file)
@@ -38,6 +38,7 @@
 #include <mLib/crc32.h>
 #include <mLib/dstr.h>
 #include <mLib/hash.h>
+#include <mLib/macros.h>
 #include <mLib/str.h>
 #include <mLib/sub.h>
 #include <mLib/sym.h>
@@ -142,9 +143,9 @@ static int insert(key_file *f, key *k)
 static time_t exptime(const char *p)
 {
   size_t sz = strlen(p);
-  if (strncmp(p, "expired", sz) == 0)
+  if (STRNCMP(p, ==, "expired", sz))
     return (KEXP_EXPIRE);
-  else if (strncmp(p, "forever", sz) == 0)
+  else if (STRNCMP(p, ==, "forever", sz))
     return (KEXP_FOREVER);
   else
     return (atol(p));
@@ -182,7 +183,7 @@ static void merge_core(key_file *f, const char *file, int lno, char *p,
    * maintained file I don't know.
    */
 
-  while (isspace((unsigned char)*p))
+  while (ISSPACE(*p))
     p++;
   if (!*p || *p == '#')
     goto skip;
@@ -287,9 +288,9 @@ static void merge_core(key_file *f, const char *file, int lno, char *p,
 
   /* --- Parse up the attributes, if specified --- */
 
-  sym_create(&k->a);
-  if (vf[4] && strcmp(vf[4], "-") != 0) {
-    url_dctx uc;
+    sym_create(&k->a);
+    if (vf[4] && STRCMP(vf[4], !=, "-")) {
+      url_dctx uc;
     for (url_initdec(&uc, vf[4]); url_dec(&uc, n, v); ) {
       key_putattr(f, k, n->buf, v->buf);
       DRESET(n); DRESET(v);