base/asm-common.h (x86), and knock-on: Add macros for full-size regs.
[catacomb] / progs / hashsum.c
index df1fdae..deb27d5 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <mLib/alloc.h>
 #include <mLib/dstr.h>
+#include <mLib/macros.h>
 #include <mLib/mdwopt.h>
 #include <mLib/quis.h>
 #include <mLib/report.h>
@@ -97,7 +98,7 @@ static int checkhash(fhashstate *fh, const char *file, const encodeops *e)
   unsigned long n = 0, nfail = 0;
   int hf;
 
-  if (!file || strcmp(file, "-") == 0)
+  if (!file || STRCMP(file, ==, "-"))
     hfp.fp = stdin;
   else if ((hfp.fp = fopen(file, fh->f & GSF_RAW ? "r" : "rb")) == 0) {
     moan("couldn't open `%s': %s", file, strerror(errno));
@@ -124,8 +125,8 @@ static int checkhash(fhashstate *fh, const char *file, const encodeops *e)
          rc = EXIT_FAILURE;
          continue;
        }
-       if (memcmp(hfp.hbuf, hfp.hbuf + hfp.gch->hashsz,
-                  hfp.gch->hashsz) != 0) {
+       if (MEMCMP(hfp.hbuf, !=, hfp.hbuf + hfp.gch->hashsz,
+                  hfp.gch->hashsz)) {
          if (hfp.f & f_verbose)
            fprintf(stderr, "FAIL %s\n", df.buf);
          else
@@ -190,7 +191,7 @@ static int hashfiles(fhashstate *fh, const char *file, const encodeops *e)
   int rc = 0;
   int rrc;
 
-  if (!file || strcmp(file, "-") == 0)
+  if (!file || STRCMP(file, ==, "-"))
     fp = stdin;
   else if ((fp = fopen(file, fh->f & GSF_RAW ? "r" : "rb")) == 0) {
     moan("couldn't open `%s': %s", file, strerror(errno));
@@ -278,7 +279,7 @@ int main(int argc, char *argv[])
   {
     char *q = xstrdup(QUIS);
     size_t len = strlen(q);
-    if (len > 3 && strcmp(q + len - 3, "sum") == 0) {
+    if (len > 3 && STRCMP(q + len - 3, ==, "sum")) {
       q[len - 3] = 0;
       fh.gch = gethash(q);
     }