This set of patches makes use of memeq() instead of memcmp() == 0,
in all the Gnulib tests.


2026-03-01  Bruno Haible  <[email protected]>

        tests: Use memeq, part 3.
        * tests/**/*.[hc]: Use memeq instead of memcmp.
        * modules/*-tests (Dependencies): Add memeq.

        tests: Use memeq, part 2.
        Done through
          sed -e 's/memcmp \([(][^()]*[)]\) != 0/!memeq \1/g' \
              -e 's/memcmp \([(][^()]*[(][^()]*[)][^()]*[)]\) != 0/!memeq \1/g'
        * tests/**/*.[hc]: Use !memeq instead of memcmp ... != 0.
        * modules/*-tests (Dependencies): Add memeq.

        tests: Use memeq, part 1.
        Done through
          sed -e 's/memcmp \([(][^()]*[)]\) == 0/memeq \1/g' \
              -e 's/memcmp \([(][^()]*[(][^()]*[)][^()]*[)]\) == 0/memeq \1/g'
        * tests/**/*.[hc]: Use memeq instead of memcmp ... == 0.
        * modules/*-tests (Dependencies): Add memeq.

Attachment: 0001-tests-Use-memeq-part-1.patch.gz
Description: application/gzip

>From 0e0dc90965bf4be54be1515d4ab64bece4c09fdc Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 1 Mar 2026 12:36:45 +0100
Subject: [PATCH 2/3] tests: Use memeq, part 2.

Done through
  sed -e 's/memcmp \([(][^()]*[)]\) != 0/!memeq \1/g' \
      -e 's/memcmp \([(][^()]*[(][^()]*[)][^()]*[)]\) != 0/!memeq \1/g'

* tests/**/*.[hc]: Use !memeq instead of memcmp ... != 0.
* modules/*-tests (Dependencies): Add memeq.
---
 ChangeLog                                        | 7 +++++++
 modules/acl-tests                                | 1 +
 modules/crypto/gc-hmac-md5-tests                 | 1 +
 modules/crypto/gc-hmac-sha1-tests                | 1 +
 modules/crypto/gc-hmac-sha256-tests              | 1 +
 modules/crypto/gc-hmac-sha512-tests              | 1 +
 modules/crypto/gc-md2-tests                      | 1 +
 modules/crypto/gc-md4-tests                      | 1 +
 modules/crypto/gc-md5-tests                      | 1 +
 modules/crypto/gc-pbkdf2-sha1-tests              | 1 +
 modules/crypto/gc-pbkdf2-tests                   | 1 +
 modules/crypto/gc-rijndael-tests                 | 1 +
 modules/crypto/gc-sha1-tests                     | 1 +
 modules/crypto/gc-sha256-tests                   | 1 +
 modules/crypto/gc-sha512-tests                   | 1 +
 modules/crypto/gc-sm3-tests                      | 1 +
 modules/crypto/hmac-md5-tests                    | 1 +
 modules/crypto/hmac-sha1-tests                   | 1 +
 modules/crypto/hmac-sha256-tests                 | 1 +
 modules/crypto/hmac-sha512-tests                 | 1 +
 modules/crypto/md5-tests                         | 1 +
 modules/crypto/rijndael-tests                    | 1 +
 modules/crypto/sha1-tests                        | 1 +
 modules/crypto/sha256-tests                      | 1 +
 modules/crypto/sha512-tests                      | 1 +
 modules/filenamecat-tests                        | 1 +
 modules/getentropy-tests                         | 1 +
 modules/getrandom-tests                          | 1 +
 modules/gettimeofday-tests                       | 1 +
 modules/posix_spawn_file_actions_addfchdir-tests | 1 +
 modules/uniwbrk/u32-wordbreaks-tests             | 1 +
 modules/vasnwprintf-posix-tests                  | 1 +
 tests/test-copysign.c                            | 4 ++--
 tests/test-copysignf.c                           | 4 ++--
 tests/test-copysignl.c                           | 4 ++--
 tests/test-digest.h                              | 2 +-
 tests/test-explicit_bzero.c                      | 4 ++--
 tests/test-filenamecat.c                         | 2 +-
 tests/test-gc-hmac-md5.c                         | 2 +-
 tests/test-gc-hmac-sha1.c                        | 2 +-
 tests/test-gc-hmac-sha256.c                      | 2 +-
 tests/test-gc-hmac-sha512.c                      | 2 +-
 tests/test-gc-md2.c                              | 6 +++---
 tests/test-gc-md4.c                              | 6 +++---
 tests/test-gc-md5.c                              | 6 +++---
 tests/test-gc-pbkdf2-sha1.c                      | 2 +-
 tests/test-gc-pbkdf2.c                           | 2 +-
 tests/test-gc-rijndael.c                         | 6 +++---
 tests/test-gc-sha1.c                             | 6 +++---
 tests/test-gc-sha256.c                           | 6 +++---
 tests/test-gc-sha512.c                           | 6 +++---
 tests/test-gc-sm3.c                              | 6 +++---
 tests/test-getentropy.c                          | 4 ++--
 tests/test-getrandom.c                           | 4 ++--
 tests/test-gettimeofday.c                        | 2 +-
 tests/test-hmac-md5.c                            | 2 +-
 tests/test-hmac-sha1.c                           | 2 +-
 tests/test-hmac-sha256.c                         | 2 +-
 tests/test-hmac-sha512.c                         | 2 +-
 tests/test-memset_explicit.c                     | 4 ++--
 tests/test-posix_spawn-dup2-stdout.c             | 2 +-
 tests/test-posix_spawn-fchdir.c                  | 2 +-
 tests/test-rijndael.c                            | 4 ++--
 tests/test-sameacls.c                            | 4 ++--
 tests/test-snprintf-posix.h                      | 2 +-
 tests/test-sprintf-posix.h                       | 2 +-
 tests/test-supersede-fopen.h                     | 4 ++--
 tests/test-supersede-open.h                      | 4 ++--
 tests/test-vasnprintf-posix.c                    | 2 +-
 tests/test-vasnwprintf-posix.c                   | 2 +-
 tests/test-vasprintf-posix.c                     | 2 +-
 tests/uniwbrk/test-uc-wordbreaks.c               | 2 +-
 72 files changed, 105 insertions(+), 67 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3845e48908..027279a99a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2026-03-01  Bruno Haible  <[email protected]>
 
+	tests: Use memeq, part 2.
+	Done through
+	  sed -e 's/memcmp \([(][^()]*[)]\) != 0/!memeq \1/g' \
+	      -e 's/memcmp \([(][^()]*[(][^()]*[)][^()]*[)]\) != 0/!memeq \1/g'
+	* tests/**/*.[hc]: Use !memeq instead of memcmp ... != 0.
+	* modules/*-tests (Dependencies): Add memeq.
+
 	tests: Use memeq, part 1.
 	Done through
 	  sed -e 's/memcmp \([(][^()]*[)]\) == 0/memeq \1/g' \
diff --git a/modules/acl-tests b/modules/acl-tests
index 24da55d095..267c67f844 100644
--- a/modules/acl-tests
+++ b/modules/acl-tests
@@ -17,6 +17,7 @@ unistd-h
 xalloc
 test-framework-sh
 streq
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-hmac-md5-tests b/modules/crypto/gc-hmac-md5-tests
index a3f7533b78..c897abde61 100644
--- a/modules/crypto/gc-hmac-md5-tests
+++ b/modules/crypto/gc-hmac-md5-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-hmac-md5.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-hmac-sha1-tests b/modules/crypto/gc-hmac-sha1-tests
index d473db6a6e..67f17cce44 100644
--- a/modules/crypto/gc-hmac-sha1-tests
+++ b/modules/crypto/gc-hmac-sha1-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-hmac-sha1.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-hmac-sha256-tests b/modules/crypto/gc-hmac-sha256-tests
index 596524cedf..a425ae77f3 100644
--- a/modules/crypto/gc-hmac-sha256-tests
+++ b/modules/crypto/gc-hmac-sha256-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-hmac-sha256.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-hmac-sha512-tests b/modules/crypto/gc-hmac-sha512-tests
index a03da0cbc3..e70ed35149 100644
--- a/modules/crypto/gc-hmac-sha512-tests
+++ b/modules/crypto/gc-hmac-sha512-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-hmac-sha512.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-md2-tests b/modules/crypto/gc-md2-tests
index 9600d8df19..5b97d744c7 100644
--- a/modules/crypto/gc-md2-tests
+++ b/modules/crypto/gc-md2-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-md2.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-md4-tests b/modules/crypto/gc-md4-tests
index 9d9b4aa610..9872285714 100644
--- a/modules/crypto/gc-md4-tests
+++ b/modules/crypto/gc-md4-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-md4.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-md5-tests b/modules/crypto/gc-md5-tests
index c4f0cd9ab7..9664d5df99 100644
--- a/modules/crypto/gc-md5-tests
+++ b/modules/crypto/gc-md5-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-md5.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-pbkdf2-sha1-tests b/modules/crypto/gc-pbkdf2-sha1-tests
index 51996c0949..1418a63225 100644
--- a/modules/crypto/gc-pbkdf2-sha1-tests
+++ b/modules/crypto/gc-pbkdf2-sha1-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-pbkdf2-sha1.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-pbkdf2-tests b/modules/crypto/gc-pbkdf2-tests
index f2dbb5db45..cbdeeefc2b 100644
--- a/modules/crypto/gc-pbkdf2-tests
+++ b/modules/crypto/gc-pbkdf2-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-pbkdf2.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-rijndael-tests b/modules/crypto/gc-rijndael-tests
index a6ad2f8ae4..13dc821018 100644
--- a/modules/crypto/gc-rijndael-tests
+++ b/modules/crypto/gc-rijndael-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-rijndael.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-sha1-tests b/modules/crypto/gc-sha1-tests
index c19cffa1f3..8e4b727268 100644
--- a/modules/crypto/gc-sha1-tests
+++ b/modules/crypto/gc-sha1-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-sha1.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-sha256-tests b/modules/crypto/gc-sha256-tests
index eb049c8852..3a14fc27b1 100644
--- a/modules/crypto/gc-sha256-tests
+++ b/modules/crypto/gc-sha256-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-sha256.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-sha512-tests b/modules/crypto/gc-sha512-tests
index 0e650235d9..9a407947a5 100644
--- a/modules/crypto/gc-sha512-tests
+++ b/modules/crypto/gc-sha512-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-sha512.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-sm3-tests b/modules/crypto/gc-sm3-tests
index 5afdcac1ae..4b2333549b 100644
--- a/modules/crypto/gc-sm3-tests
+++ b/modules/crypto/gc-sm3-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-sm3.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/hmac-md5-tests b/modules/crypto/hmac-md5-tests
index ddf20d94fb..57b63a373b 100644
--- a/modules/crypto/hmac-md5-tests
+++ b/modules/crypto/hmac-md5-tests
@@ -3,6 +3,7 @@ tests/test-hmac-md5.c
 
 Depends-on:
 c99
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/hmac-sha1-tests b/modules/crypto/hmac-sha1-tests
index 5606df6c41..cc5425a114 100644
--- a/modules/crypto/hmac-sha1-tests
+++ b/modules/crypto/hmac-sha1-tests
@@ -3,6 +3,7 @@ tests/test-hmac-sha1.c
 
 Depends-on:
 c99
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/hmac-sha256-tests b/modules/crypto/hmac-sha256-tests
index 3f93819fc4..20dc9e194e 100644
--- a/modules/crypto/hmac-sha256-tests
+++ b/modules/crypto/hmac-sha256-tests
@@ -3,6 +3,7 @@ tests/test-hmac-sha256.c
 
 Depends-on:
 c99
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/hmac-sha512-tests b/modules/crypto/hmac-sha512-tests
index 7e36dfb5a5..477f83eecb 100644
--- a/modules/crypto/hmac-sha512-tests
+++ b/modules/crypto/hmac-sha512-tests
@@ -3,6 +3,7 @@ tests/test-hmac-sha512.c
 
 Depends-on:
 c99
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/md5-tests b/modules/crypto/md5-tests
index b2de00a548..3e9cbaaac9 100644
--- a/modules/crypto/md5-tests
+++ b/modules/crypto/md5-tests
@@ -5,6 +5,7 @@ tests/macros.h
 
 Depends-on:
 c99
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/rijndael-tests b/modules/crypto/rijndael-tests
index cbf861f82d..90df797ceb 100644
--- a/modules/crypto/rijndael-tests
+++ b/modules/crypto/rijndael-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-rijndael.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/sha1-tests b/modules/crypto/sha1-tests
index b774ffcee5..35d9ba3546 100644
--- a/modules/crypto/sha1-tests
+++ b/modules/crypto/sha1-tests
@@ -5,6 +5,7 @@ tests/macros.h
 
 Depends-on:
 c99
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/sha256-tests b/modules/crypto/sha256-tests
index 9357cc24d5..9e3f913b6a 100644
--- a/modules/crypto/sha256-tests
+++ b/modules/crypto/sha256-tests
@@ -5,6 +5,7 @@ tests/macros.h
 
 Depends-on:
 c99
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/sha512-tests b/modules/crypto/sha512-tests
index 9efe7d234e..b4bd839f9f 100644
--- a/modules/crypto/sha512-tests
+++ b/modules/crypto/sha512-tests
@@ -5,6 +5,7 @@ tests/macros.h
 
 Depends-on:
 c99
+memeq
 
 configure.ac:
 
diff --git a/modules/filenamecat-tests b/modules/filenamecat-tests
index a3b6abd1ba..c7c422ff79 100644
--- a/modules/filenamecat-tests
+++ b/modules/filenamecat-tests
@@ -5,6 +5,7 @@ Depends-on:
 idx
 bool
 streq
+memeq
 
 configure.ac:
 
diff --git a/modules/getentropy-tests b/modules/getentropy-tests
index f384698d80..5f13885ab3 100644
--- a/modules/getentropy-tests
+++ b/modules/getentropy-tests
@@ -4,6 +4,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/getrandom-tests b/modules/getrandom-tests
index 1f9c67b884..3165adf7e0 100644
--- a/modules/getrandom-tests
+++ b/modules/getrandom-tests
@@ -4,6 +4,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/gettimeofday-tests b/modules/gettimeofday-tests
index a08631d836..87dd24f0f6 100644
--- a/modules/gettimeofday-tests
+++ b/modules/gettimeofday-tests
@@ -5,6 +5,7 @@ tests/macros.h
 
 Depends-on:
 time
+memeq
 
 configure.ac:
 
diff --git a/modules/posix_spawn_file_actions_addfchdir-tests b/modules/posix_spawn_file_actions_addfchdir-tests
index ec92884349..e5ac18faab 100644
--- a/modules/posix_spawn_file_actions_addfchdir-tests
+++ b/modules/posix_spawn_file_actions_addfchdir-tests
@@ -12,6 +12,7 @@ posix_spawnp-tests
 bool
 findprog
 xvasprintf
+memeq
 
 configure.ac:
 AC_EGREP_CPP([notposix], [[
diff --git a/modules/uniwbrk/u32-wordbreaks-tests b/modules/uniwbrk/u32-wordbreaks-tests
index 897d4a4ec8..36ce127348 100644
--- a/modules/uniwbrk/u32-wordbreaks-tests
+++ b/modules/uniwbrk/u32-wordbreaks-tests
@@ -6,6 +6,7 @@ tests/uniwbrk/WordBreakTest.txt
 tests/macros.h
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/vasnwprintf-posix-tests b/modules/vasnwprintf-posix-tests
index d62437f2f5..025c59aac8 100644
--- a/modules/vasnwprintf-posix-tests
+++ b/modules/vasnwprintf-posix-tests
@@ -22,6 +22,7 @@ wcscmp
 wcsspn
 wmemcmp
 wmemcpy
+memeq
 
 configure.ac:
 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
diff --git a/tests/test-copysign.c b/tests/test-copysign.c
index 62abaa1ced..0d057920ec 100644
--- a/tests/test-copysign.c
+++ b/tests/test-copysign.c
@@ -93,7 +93,7 @@ main ()
   y = -1.0;
   z = copysign (x, y);
   ASSERT (z == 0.0);
-  ASSERT (memcmp (&z, &zero, sizeof z) != 0);
+  ASSERT (!memeq (&z, &zero, sizeof z));
 
   x = minus_zerod;
   y = 1.0;
@@ -105,7 +105,7 @@ main ()
   y = -1.0;
   z = copysign (x, y);
   ASSERT (z == 0.0);
-  ASSERT (memcmp (&z, &zero, sizeof z) != 0);
+  ASSERT (!memeq (&z, &zero, sizeof z));
 
   return test_exit_status;
 }
diff --git a/tests/test-copysignf.c b/tests/test-copysignf.c
index 27300ec65b..83daf3c8ba 100644
--- a/tests/test-copysignf.c
+++ b/tests/test-copysignf.c
@@ -93,7 +93,7 @@ main ()
   y = -1.0f;
   z = copysignf (x, y);
   ASSERT (z == 0.0f);
-  ASSERT (memcmp (&z, &zero, sizeof z) != 0);
+  ASSERT (!memeq (&z, &zero, sizeof z));
 
   x = minus_zerof;
   y = 1.0f;
@@ -105,7 +105,7 @@ main ()
   y = -1.0f;
   z = copysignf (x, y);
   ASSERT (z == 0.0f);
-  ASSERT (memcmp (&z, &zero, sizeof z) != 0);
+  ASSERT (!memeq (&z, &zero, sizeof z));
 
   return test_exit_status;
 }
diff --git a/tests/test-copysignl.c b/tests/test-copysignl.c
index ce86bd0586..ce6ad60080 100644
--- a/tests/test-copysignl.c
+++ b/tests/test-copysignl.c
@@ -102,7 +102,7 @@ main ()
   y = -1.0L;
   z = copysignl (x, y);
   ASSERT (z == 0.0L);
-  ASSERT (memcmp (&z, &zero, LDBL_BYTES) != 0);
+  ASSERT (!memeq (&z, &zero, LDBL_BYTES));
 
   x = minus_zerol;
   y = 1.0L;
@@ -114,7 +114,7 @@ main ()
   y = -1.0L;
   z = copysignl (x, y);
   ASSERT (z == 0.0L);
-  ASSERT (memcmp (&z, &zero, LDBL_BYTES) != 0);
+  ASSERT (!memeq (&z, &zero, LDBL_BYTES));
 
   return test_exit_status;
 }
diff --git a/tests/test-digest.h b/tests/test-digest.h
index 259f128141..ed0fe79b2a 100644
--- a/tests/test-digest.h
+++ b/tests/test-digest.h
@@ -111,7 +111,7 @@ test_digest_on_files (int (*streamfunc) (FILE *, void *),
             fprintf (stderr, "%s failed with error %d\n", streamfunc_name, -ret);
             exit (1);
           }
-        if (memcmp (digest, expected, digest_size) != 0)
+        if (!memeq (digest, expected, digest_size))
           {
             fprintf (stderr, "%s produced wrong result.\n", streamfunc_name);
             fprintf (stderr, "Expected: ");
diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c
index 211d74fc0d..6abb85f180 100644
--- a/tests/test-explicit_bzero.c
+++ b/tests/test-explicit_bzero.c
@@ -134,7 +134,7 @@ test_heap (void)
     {
       /* some implementation could override freed memory by canaries so
          compare against secret */
-      ASSERT (memcmp (heapbuf, SECRET, SECRET_SIZE) != 0);
+      ASSERT (!memeq (heapbuf, SECRET, SECRET_SIZE));
       printf ("test_heap: address range is still mapped after free().\n");
     }
   else
@@ -194,7 +194,7 @@ do_secret_stuff (int volatile pass, char *volatile *volatile last_stackbuf)
          different address than *last_stackbuf.  This can happen
          when the compiler splits this function into different functions,
          one for pass == 1 and one for pass != 1.  */
-      return memcmp (zero, *last_stackbuf, SECRET_SIZE) != 0;
+      return !memeq (zero, *last_stackbuf, SECRET_SIZE);
     }
 }
 
diff --git a/tests/test-filenamecat.c b/tests/test-filenamecat.c
index 704ec84afd..bc0a144ee9 100644
--- a/tests/test-filenamecat.c
+++ b/tests/test-filenamecat.c
@@ -73,7 +73,7 @@ main (_GL_UNUSED int argc, char *argv[])
           fprintf (stderr, "test #%u: base_in_result is not in result\n", i);
           fail = true;
         }
-      if (reslen < t0len || memcmp (res, t[0], t0len) != 0)
+      if (reslen < t0len || !memeq (res, t[0], t0len))
         {
           fprintf (stderr, "test #%u: %s is not a prefix of %s\n",
                    i, t[0], res);
diff --git a/tests/test-gc-hmac-md5.c b/tests/test-gc-hmac-md5.c
index 3c55e8be6a..ff06e22a9c 100644
--- a/tests/test-gc-hmac-md5.c
+++ b/tests/test-gc-hmac-md5.c
@@ -60,7 +60,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (digest, out, 16) != 0)
+    if (!memeq (digest, out, 16))
       {
         printf ("hash 1 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
diff --git a/tests/test-gc-hmac-sha1.c b/tests/test-gc-hmac-sha1.c
index 1a46ecc446..911a437125 100644
--- a/tests/test-gc-hmac-sha1.c
+++ b/tests/test-gc-hmac-sha1.c
@@ -51,7 +51,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (digest, out, GC_SHA1_DIGEST_SIZE) != 0)
+    if (!memeq (digest, out, GC_SHA1_DIGEST_SIZE))
       {
         printf ("hash 1 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
diff --git a/tests/test-gc-hmac-sha256.c b/tests/test-gc-hmac-sha256.c
index 6c0583a499..6e72da97d7 100644
--- a/tests/test-gc-hmac-sha256.c
+++ b/tests/test-gc-hmac-sha256.c
@@ -50,7 +50,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (digest, out, GC_SHA256_DIGEST_SIZE) != 0)
+    if (!memeq (digest, out, GC_SHA256_DIGEST_SIZE))
       {
         printf ("hash 1 mismatch. expected:\n");
         for (size_t i = 0; i < GC_SHA256_DIGEST_SIZE; i++)
diff --git a/tests/test-gc-hmac-sha512.c b/tests/test-gc-hmac-sha512.c
index 8de49afc82..80d1e18210 100644
--- a/tests/test-gc-hmac-sha512.c
+++ b/tests/test-gc-hmac-sha512.c
@@ -50,7 +50,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (digest, out, GC_SHA512_DIGEST_SIZE) != 0)
+    if (!memeq (digest, out, GC_SHA512_DIGEST_SIZE))
       {
         printf ("hash 1 mismatch. expected:\n");
         for (size_t i = 0; i < GC_SHA512_DIGEST_SIZE; i++)
diff --git a/tests/test-gc-md2.c b/tests/test-gc-md2.c
index e8fa9ac472..65fb139f09 100644
--- a/tests/test-gc-md2.c
+++ b/tests/test-gc-md2.c
@@ -51,7 +51,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 16) != 0)
+    if (!memeq (out, expect, 16))
       {
         printf ("md2 1 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
@@ -69,7 +69,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 16) != 0)
+    if (!memeq (out, expect, 16))
       {
         printf ("md2 2 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
@@ -103,7 +103,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (p, expect, 16) != 0)
+    if (!memeq (p, expect, 16))
       {
         printf ("md2 3 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
diff --git a/tests/test-gc-md4.c b/tests/test-gc-md4.c
index 58a51a8c52..fc44176c9c 100644
--- a/tests/test-gc-md4.c
+++ b/tests/test-gc-md4.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 16) != 0)
+    if (!memeq (out, expect, 16))
       {
         printf ("md4 1 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 16) != 0)
+    if (!memeq (out, expect, 16))
       {
         printf ("md4 1 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (p, expect, 16) != 0)
+    if (!memeq (p, expect, 16))
       {
         printf ("md4 1 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
diff --git a/tests/test-gc-md5.c b/tests/test-gc-md5.c
index 7bde518630..227af78f32 100644
--- a/tests/test-gc-md5.c
+++ b/tests/test-gc-md5.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 16) != 0)
+    if (!memeq (out, expect, 16))
       {
         printf ("md5 1 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 16) != 0)
+    if (!memeq (out, expect, 16))
       {
         printf ("md5 2 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (p, expect, 16) != 0)
+    if (!memeq (p, expect, 16))
       {
         printf ("md5 3 mismatch. expected:\n");
         for (size_t i = 0; i < 16; i++)
diff --git a/tests/test-gc-pbkdf2-sha1.c b/tests/test-gc-pbkdf2-sha1.c
index 36c4099907..0981cc2b6c 100644
--- a/tests/test-gc-pbkdf2-sha1.c
+++ b/tests/test-gc-pbkdf2-sha1.c
@@ -95,7 +95,7 @@ main (int argc, char *argv[])
           return 1;
         }
 
-      if (memcmp (pkcs5[i].expected, out, pkcs5[i].dklen) != 0)
+      if (!memeq (pkcs5[i].expected, out, pkcs5[i].dklen))
         {
           printf ("PKCS5 entry %ld failed\n", (unsigned long) i);
           return 1;
diff --git a/tests/test-gc-pbkdf2.c b/tests/test-gc-pbkdf2.c
index d27a821ce4..c16ed4f074 100644
--- a/tests/test-gc-pbkdf2.c
+++ b/tests/test-gc-pbkdf2.c
@@ -119,7 +119,7 @@ main (int argc, char *argv[])
           return 1;
         }
 
-      if (memcmp (pkcs5[i].expected, out, pkcs5[i].dklen) != 0)
+      if (!memeq (pkcs5[i].expected, out, pkcs5[i].dklen))
         {
           printf ("PKCS5 entry %ld failed\n", (unsigned long) i);
           return 1;
diff --git a/tests/test-gc-rijndael.c b/tests/test-gc-rijndael.c
index a7ea2d16dd..97dffe6a17 100644
--- a/tests/test-gc-rijndael.c
+++ b/tests/test-gc-rijndael.c
@@ -64,7 +64,7 @@ main (int argc, char *argv[])
           }
       }
 
-    if (memcmp (buf, ct, 16) != 0)
+    if (!memeq (buf, ct, 16))
       {
         printf ("expected:\n");
         for (size_t i = 0; i < 16; i++)
@@ -86,7 +86,7 @@ main (int argc, char *argv[])
           }
       }
 
-    if (memcmp (buf, pt, 16) != 0)
+    if (!memeq (buf, pt, 16))
       {
         printf ("expected:\n");
         for (size_t i = 0; i < 16; i++)
@@ -138,7 +138,7 @@ main (int argc, char *argv[])
           }
       }
 
-    if (memcmp (buf, ct, 16) != 0)
+    if (!memeq (buf, ct, 16))
       {
         printf ("expected:\n");
         for (size_t i = 0; i < 16; i++)
diff --git a/tests/test-gc-sha1.c b/tests/test-gc-sha1.c
index ce21793103..da61cd6031 100644
--- a/tests/test-gc-sha1.c
+++ b/tests/test-gc-sha1.c
@@ -49,7 +49,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 20) != 0)
+    if (!memeq (out, expect, 20))
       {
         printf ("sha1 test1 mismatch. expected:\n");
         for (size_t i = 0; i < 20; i++)
@@ -68,7 +68,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 20) != 0)
+    if (!memeq (out, expect, 20))
       {
         printf ("sha1 test2 mismatch. expected:\n");
         for (size_t i = 0; i < 20; i++)
@@ -102,7 +102,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (p, expect, 20) != 0)
+    if (!memeq (p, expect, 20))
       {
         printf ("sha1 test3 mismatch. expected:\n");
         for (size_t i = 0; i < 20; i++)
diff --git a/tests/test-gc-sha256.c b/tests/test-gc-sha256.c
index 2754259d6d..0997142c0f 100644
--- a/tests/test-gc-sha256.c
+++ b/tests/test-gc-sha256.c
@@ -50,7 +50,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 32) != 0)
+    if (!memeq (out, expect, 32))
       {
         printf ("sha256 test1 mismatch. expected:\n");
         for (size_t i = 0; i < 32; i++)
@@ -69,7 +69,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 32) != 0)
+    if (!memeq (out, expect, 32))
       {
         printf ("sha256 test2 mismatch. expected:\n");
         for (size_t i = 0; i < 32; i++)
@@ -103,7 +103,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (p, expect, 32) != 0)
+    if (!memeq (p, expect, 32))
       {
         printf ("sha256 test3 mismatch. expected:\n");
         for (size_t i = 0; i < 32; i++)
diff --git a/tests/test-gc-sha512.c b/tests/test-gc-sha512.c
index 448a899553..c8206ecb95 100644
--- a/tests/test-gc-sha512.c
+++ b/tests/test-gc-sha512.c
@@ -52,7 +52,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 64) != 0)
+    if (!memeq (out, expect, 64))
       {
         printf ("sha512 test1 mismatch. expected:\n");
         for (size_t i = 0; i < 64; i++)
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 64) != 0)
+    if (!memeq (out, expect, 64))
       {
         printf ("sha512 test2 mismatch. expected:\n");
         for (size_t i = 0; i < 64; i++)
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (p, expect, 64) != 0)
+    if (!memeq (p, expect, 64))
       {
         printf ("sha512 test3 mismatch. expected:\n");
         for (size_t i = 0; i < 64; i++)
diff --git a/tests/test-gc-sm3.c b/tests/test-gc-sm3.c
index 5e5e40bbae..8fbe256ad4 100644
--- a/tests/test-gc-sm3.c
+++ b/tests/test-gc-sm3.c
@@ -52,7 +52,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 32) != 0)
+    if (!memeq (out, expect, 32))
       {
         printf ("sm3 mismatch. expected:\n");
         for (size_t i = 0; i < 32; i++)
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (out, expect, 32) != 0)
+    if (!memeq (out, expect, 32))
       {
         printf ("sm3' mismatch. expected:\n");
         for (size_t i = 0; i < 32; i++)
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    if (memcmp (p, expect, 32) != 0)
+    if (!memeq (p, expect, 32))
       {
         printf ("sm3 mismatch. expected:\n");
         for (size_t i = 0; i < 32; i++)
diff --git a/tests/test-getentropy.c b/tests/test-getentropy.c
index 35cf92062b..877ef120a7 100644
--- a/tests/test-getentropy.c
+++ b/tests/test-getentropy.c
@@ -37,7 +37,7 @@ main (int argc, char *argv[])
   ASSERT (getentropy (buf, sizeof buf) == 0);
 
   /* This test fails with probability 2**-2048.  (Run it again if so. :-) */
-  ASSERT (memcmp (buf, empty_buf, sizeof buf) != 0);
+  ASSERT (!memeq (buf, empty_buf, sizeof buf));
 
   /* It is very unlikely that two calls to getentropy produce the same
      results.  */
@@ -47,7 +47,7 @@ main (int argc, char *argv[])
 
     ASSERT (getentropy (buf1, sizeof (buf1)) == 0);
     ASSERT (getentropy (buf2, sizeof (buf2)) == 0);
-    ASSERT (memcmp (buf1, buf2, sizeof (buf1)) != 0);
+    ASSERT (!memeq (buf1, buf2, sizeof (buf1)));
   }
 
   return test_exit_status;
diff --git a/tests/test-getrandom.c b/tests/test-getrandom.c
index 7f94bd0ca0..3c9c09b218 100644
--- a/tests/test-getrandom.c
+++ b/tests/test-getrandom.c
@@ -50,7 +50,7 @@ main (void)
         {
           /* It is very unlikely that two calls to getrandom produce the
              same results.  */
-          ASSERT (memcmp (buf1, buf2, sizeof (buf1)) != 0);
+          ASSERT (!memeq (buf1, buf2, sizeof (buf1)));
         }
     }
 
@@ -67,7 +67,7 @@ main (void)
         {
           /* It is very unlikely that two calls to getrandom produce the
              same results.  */
-          ASSERT (memcmp (buf1, buf2, sizeof (buf1)) != 0);
+          ASSERT (!memeq (buf1, buf2, sizeof (buf1)));
         }
     }
 
diff --git a/tests/test-gettimeofday.c b/tests/test-gettimeofday.c
index 3317b06b02..c39a694870 100644
--- a/tests/test-gettimeofday.c
+++ b/tests/test-gettimeofday.c
@@ -42,7 +42,7 @@ test_clobber ()
   lt = localtime (&t);
   saved_lt = *lt;
   gettimeofday (&tv, NULL);
-  if (memcmp (lt, &saved_lt, sizeof (struct tm)) != 0)
+  if (!memeq (lt, &saved_lt, sizeof (struct tm)))
     {
       fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n");
       exit (1);
diff --git a/tests/test-hmac-md5.c b/tests/test-hmac-md5.c
index 9c05653a97..59ddfe3b20 100644
--- a/tests/test-hmac-md5.c
+++ b/tests/test-hmac-md5.c
@@ -38,7 +38,7 @@ hmac_check (const void *key, size_t key_len,
       exit (1);
     }
 
-  if (memcmp (digest, out, 16) != 0)
+  if (!memeq (digest, out, 16))
     {
       printf ("hash 1 mismatch. expected:\n");
       for (size_t i = 0; i < 16; i++)
diff --git a/tests/test-hmac-sha1.c b/tests/test-hmac-sha1.c
index 26ffdd969f..1d77f3c80e 100644
--- a/tests/test-hmac-sha1.c
+++ b/tests/test-hmac-sha1.c
@@ -36,7 +36,7 @@ hmac_check (const void *key, size_t key_len,
       exit (1);
     }
 
-  if (memcmp (digest, out, 20) != 0)
+  if (!memeq (digest, out, 20))
     {
       printf ("hash 1 mismatch. expected:\n");
       for (size_t i = 0; i < 20; i++)
diff --git a/tests/test-hmac-sha256.c b/tests/test-hmac-sha256.c
index cdc49379a7..38135738af 100644
--- a/tests/test-hmac-sha256.c
+++ b/tests/test-hmac-sha256.c
@@ -36,7 +36,7 @@ hmac_check (const void *key, size_t key_len,
       exit (1);
     }
 
-  if (memcmp (digest, out, 32) != 0)
+  if (!memeq (digest, out, 32))
     {
       printf ("hash 1 mismatch. expected:\n");
       for (size_t i = 0; i < 32; i++)
diff --git a/tests/test-hmac-sha512.c b/tests/test-hmac-sha512.c
index 425e71c681..aa9838482e 100644
--- a/tests/test-hmac-sha512.c
+++ b/tests/test-hmac-sha512.c
@@ -36,7 +36,7 @@ hmac_check (const void *key, size_t key_len,
       exit (1);
     }
 
-  if (memcmp (digest, out, 64) != 0)
+  if (!memeq (digest, out, 64))
     {
       printf ("hash 1 mismatch. expected:\n");
       for (size_t i = 0; i < 64; i++)
diff --git a/tests/test-memset_explicit.c b/tests/test-memset_explicit.c
index 6c308f1f7a..02cb7e01ef 100644
--- a/tests/test-memset_explicit.c
+++ b/tests/test-memset_explicit.c
@@ -160,7 +160,7 @@ test_heap (void)
     {
       /* some implementation could override freed memory by canaries so
          compare against secret */
-      ASSERT (memcmp (heapbuf, SECRET, SECRET_SIZE) != 0);
+      ASSERT (!memeq (heapbuf, SECRET, SECRET_SIZE));
       printf ("test_heap: address range is still mapped after free().\n");
     }
   else
@@ -219,7 +219,7 @@ do_secret_stuff (int pass, char *volatile *last_stackbuf)
          different address than *last_stackbuf.  This can happen
          when the compiler splits this function into different functions,
          one for pass == 1 and one for pass != 1.  */
-      return memcmp (zero, *last_stackbuf, SECRET_SIZE) != 0;
+      return !memeq (zero, *last_stackbuf, SECRET_SIZE);
     }
 }
 
diff --git a/tests/test-posix_spawn-dup2-stdout.c b/tests/test-posix_spawn-dup2-stdout.c
index 85f96f7344..b99bd4e374 100644
--- a/tests/test-posix_spawn-dup2-stdout.c
+++ b/tests/test-posix_spawn-dup2-stdout.c
@@ -150,7 +150,7 @@ main ()
       fprintf (stderr, "could not read expected output\n");
       exit (1);
     }
-  if (memcmp (line, "Halle Potta", 11) != 0)
+  if (!memeq (line, "Halle Potta", 11))
     {
       fprintf (stderr, "read output is not the expected output\n");
       exit (1);
diff --git a/tests/test-posix_spawn-fchdir.c b/tests/test-posix_spawn-fchdir.c
index 326374f928..9ae271f8c9 100644
--- a/tests/test-posix_spawn-fchdir.c
+++ b/tests/test-posix_spawn-fchdir.c
@@ -150,7 +150,7 @@ test (const char *pwd_prog)
      "/".  */
   if (!is_qemu)
     {
-      if (memcmp (line, KNOWNDIR "\n", strlen (KNOWNDIR) + 1) != 0)
+      if (!memeq (line, KNOWNDIR "\n", strlen (KNOWNDIR) + 1))
         {
           fprintf (stderr, "read output is not the expected output\n");
           exit (1);
diff --git a/tests/test-rijndael.c b/tests/test-rijndael.c
index 7325ad2209..afe92864ae 100644
--- a/tests/test-rijndael.c
+++ b/tests/test-rijndael.c
@@ -55,7 +55,7 @@ main (int argc, char *argv[])
       memcpy (in, out, RIJNDAEL_BITSPERBLOCK / 8);
     }
 
-  if (memcmp (out, ct, RIJNDAEL_BITSPERBLOCK / 8) != 0)
+  if (!memeq (out, ct, RIJNDAEL_BITSPERBLOCK / 8))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
@@ -85,7 +85,7 @@ main (int argc, char *argv[])
         printf ("blockEncrypt failed %d\n", rc);
     }
 
-  if (memcmp (out, pt, RIJNDAEL_BITSPERBLOCK / 8) != 0)
+  if (!memeq (out, pt, RIJNDAEL_BITSPERBLOCK / 8))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
diff --git a/tests/test-sameacls.c b/tests/test-sameacls.c
index 93a13be7ba..57c5ace403 100644
--- a/tests/test-sameacls.c
+++ b/tests/test-sameacls.c
@@ -77,7 +77,7 @@ main (int argc, char *argv[])
         fflush (stderr);
         abort ();
       }
-    if (memcmp (contents1, contents2, size1) != 0)
+    if (!memeq (contents1, contents2, size1))
       {
         fprintf (stderr, "files %s and %s have different contents\n",
                  file1, file2);
@@ -629,7 +629,7 @@ main (int argc, char *argv[])
                acl2.a.u_access, acl2.a.g_access, acl2.a.o_access);
       return 1;
     }
-  if (memcmp (acl1.a.acl_ext, acl2.a.acl_ext, acl1.a.acl_len) != 0)
+  if (!memeq (acl1.a.acl_ext, acl2.a.acl_ext, acl1.a.acl_len))
     {
       fprintf (stderr, "files %s and %s have different ACL entries\n",
                file1, file2);
diff --git a/tests/test-snprintf-posix.h b/tests/test-snprintf-posix.h
index 1fcf6b1d87..7ebb7eb0e3 100644
--- a/tests/test-snprintf-posix.h
+++ b/tests/test-snprintf-posix.h
@@ -27,7 +27,7 @@ have_minus_zero ()
 {
   static double plus_zero = 0.0;
   double minus_zero = minus_zerod;
-  return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
+  return !memeq (&plus_zero, &minus_zero, sizeof (double));
 }
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
diff --git a/tests/test-sprintf-posix.h b/tests/test-sprintf-posix.h
index 112a1dabe5..5daee12dbe 100644
--- a/tests/test-sprintf-posix.h
+++ b/tests/test-sprintf-posix.h
@@ -27,7 +27,7 @@ have_minus_zero ()
 {
   static double plus_zero = 0.0;
   double minus_zero = minus_zerod;
-  return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
+  return !memeq (&plus_zero, &minus_zero, sizeof (double));
 }
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
diff --git a/tests/test-supersede-fopen.h b/tests/test-supersede-fopen.h
index d5f732c3cc..83d6d138e3 100644
--- a/tests/test-supersede-fopen.h
+++ b/tests/test-supersede-fopen.h
@@ -95,7 +95,7 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist
         /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t!  */
         dev_t new_dev = statbuf.st_dev;
         ASSERT (memeq (&orig_dev, &new_dev, sizeof (dev_t)));
-        ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0);
+        ASSERT (!memeq (&orig_ino, &statbuf.st_ino, sizeof (ino_t)));
 #endif
       }
   }
@@ -167,7 +167,7 @@ test_fopen_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist
             /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t!  */
             dev_t new_dev = statbuf.st_dev;
             ASSERT (memeq (&orig_dev, &new_dev, sizeof (dev_t)));
-            ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0);
+            ASSERT (!memeq (&orig_ino, &statbuf.st_ino, sizeof (ino_t)));
 #endif
           }
 
diff --git a/tests/test-supersede-open.h b/tests/test-supersede-open.h
index 3c19fc6b2e..caa7974d54 100644
--- a/tests/test-supersede-open.h
+++ b/tests/test-supersede-open.h
@@ -93,7 +93,7 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist)
         /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t!  */
         dev_t new_dev = statbuf.st_dev;
         ASSERT (memeq (&orig_dev, &new_dev, sizeof (dev_t)));
-        ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0);
+        ASSERT (!memeq (&orig_ino, &statbuf.st_ino, sizeof (ino_t)));
 #endif
       }
   }
@@ -164,7 +164,7 @@ test_open_supersede (bool supersede_if_exists, bool supersede_if_does_not_exist)
             /* Note: On Linux/mips, statbuf.st_dev is smaller than a dev_t!  */
             dev_t new_dev = statbuf.st_dev;
             ASSERT (memeq (&orig_dev, &new_dev, sizeof (dev_t)));
-            ASSERT (memcmp (&orig_ino, &statbuf.st_ino, sizeof (ino_t)) != 0);
+            ASSERT (!memeq (&orig_ino, &statbuf.st_ino, sizeof (ino_t)));
 #endif
           }
 
diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c
index 7a48bcc96c..3692f4edaf 100644
--- a/tests/test-vasnprintf-posix.c
+++ b/tests/test-vasnprintf-posix.c
@@ -41,7 +41,7 @@ have_minus_zero ()
 {
   static double plus_zero = 0.0;
   double minus_zero = minus_zerod;
-  return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
+  return !memeq (&plus_zero, &minus_zero, sizeof (double));
 }
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
diff --git a/tests/test-vasnwprintf-posix.c b/tests/test-vasnwprintf-posix.c
index 7dc0fa4a04..b51e07b9a7 100644
--- a/tests/test-vasnwprintf-posix.c
+++ b/tests/test-vasnwprintf-posix.c
@@ -41,7 +41,7 @@ have_minus_zero ()
 {
   static double plus_zero = 0.0;
   double minus_zero = minus_zerod;
-  return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
+  return !memeq (&plus_zero, &minus_zero, sizeof (double));
 }
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c
index dd13d2dcea..36b97bf516 100644
--- a/tests/test-vasprintf-posix.c
+++ b/tests/test-vasprintf-posix.c
@@ -40,7 +40,7 @@ have_minus_zero ()
 {
   static double plus_zero = 0.0;
   double minus_zero = minus_zerod;
-  return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0;
+  return !memeq (&plus_zero, &minus_zero, sizeof (double));
 }
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
diff --git a/tests/uniwbrk/test-uc-wordbreaks.c b/tests/uniwbrk/test-uc-wordbreaks.c
index a9dcb6289d..c3f627e080 100644
--- a/tests/uniwbrk/test-uc-wordbreaks.c
+++ b/tests/uniwbrk/test-uc-wordbreaks.c
@@ -155,7 +155,7 @@ main (int argc, char *argv[])
 
       /* u32_wordbreaks always set BREAKS[0] to 0.  */
       breaks[0] = breaks_expected[0] = 1;
-      if (memcmp (breaks, breaks_expected, i - 1) != 0)
+      if (!memeq (breaks, breaks_expected, i - 1))
         {
           fprintf (stderr, "%s:%d: expected: ", filename, lineno);
           for (int j = 0; j < i - 1; j++)
-- 
2.52.0

>From 6003a49f0909d2794066dcd40b2c4908a7d3790f Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 1 Mar 2026 12:37:49 +0100
Subject: [PATCH 3/3] tests: Use memeq, part 3.

* tests/**/*.[hc]: Use memeq instead of memcmp.
* modules/*-tests (Dependencies): Add memeq.
---
 ChangeLog                          |  4 ++++
 modules/crypto/arcfour-tests       |  1 +
 modules/crypto/arctwo-tests        |  1 +
 modules/crypto/des-tests           |  1 +
 modules/crypto/gc-arcfour-tests    |  1 +
 modules/crypto/gc-arctwo-tests     |  1 +
 modules/crypto/gc-des-tests        |  1 +
 modules/crypto/md2-buffer-tests    |  1 +
 modules/crypto/md4-buffer-tests    |  1 +
 modules/crypto/md5-buffer-tests    |  1 +
 modules/crypto/sha1-buffer-tests   |  1 +
 modules/crypto/sha256-buffer-tests |  1 +
 modules/crypto/sha512-buffer-tests |  1 +
 modules/crypto/sm3-buffer-tests    |  1 +
 modules/pthread-thread-tests       |  1 +
 modules/thrd-tests                 |  1 +
 modules/thread-tests               |  1 +
 tests/test-arcfour.c               |  4 ++--
 tests/test-arctwo.c                | 24 ++++++++++++------------
 tests/test-des.c                   |  8 ++++----
 tests/test-gc-arcfour.c            |  4 ++--
 tests/test-gc-arctwo.c             |  4 ++--
 tests/test-gc-des.c                |  2 +-
 tests/test-md2-buffer.c            |  6 ++----
 tests/test-md4-buffer.c            |  6 ++----
 tests/test-md5-buffer.c            |  4 ++--
 tests/test-pthread-thread.c        |  5 ++---
 tests/test-sha1-buffer.c           |  3 +--
 tests/test-sha224-buffer.c         |  3 +--
 tests/test-sha256-buffer.c         |  3 +--
 tests/test-sha384-buffer.c         |  3 +--
 tests/test-sha512-buffer.c         |  3 +--
 tests/test-sm3-buffer.c            |  3 +--
 tests/test-thrd_create.c           |  4 +---
 tests/test-thrd_exit.c             |  4 +---
 tests/test-thread_create.c         |  5 ++---
 36 files changed, 61 insertions(+), 57 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 027279a99a..368f1c4385 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2026-03-01  Bruno Haible  <[email protected]>
 
+	tests: Use memeq, part 3.
+	* tests/**/*.[hc]: Use memeq instead of memcmp.
+	* modules/*-tests (Dependencies): Add memeq.
+
 	tests: Use memeq, part 2.
 	Done through
 	  sed -e 's/memcmp \([(][^()]*[)]\) != 0/!memeq \1/g' \
diff --git a/modules/crypto/arcfour-tests b/modules/crypto/arcfour-tests
index f02b0a6694..e1e3b98eaa 100644
--- a/modules/crypto/arcfour-tests
+++ b/modules/crypto/arcfour-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-arcfour.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/arctwo-tests b/modules/crypto/arctwo-tests
index a0b01da5a7..8c7b55916e 100644
--- a/modules/crypto/arctwo-tests
+++ b/modules/crypto/arctwo-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-arctwo.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/des-tests b/modules/crypto/des-tests
index a5850a48d5..2fe56770a8 100644
--- a/modules/crypto/des-tests
+++ b/modules/crypto/des-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-des.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-arcfour-tests b/modules/crypto/gc-arcfour-tests
index 8e8e849c9d..6ff6ab7fab 100644
--- a/modules/crypto/gc-arcfour-tests
+++ b/modules/crypto/gc-arcfour-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-arcfour.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-arctwo-tests b/modules/crypto/gc-arctwo-tests
index 7771351b6e..37d274d8ce 100644
--- a/modules/crypto/gc-arctwo-tests
+++ b/modules/crypto/gc-arctwo-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-arctwo.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/gc-des-tests b/modules/crypto/gc-des-tests
index cb5035e014..ebd1d869c1 100644
--- a/modules/crypto/gc-des-tests
+++ b/modules/crypto/gc-des-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-gc-des.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/md2-buffer-tests b/modules/crypto/md2-buffer-tests
index 20b2e9f41a..59fe99f650 100644
--- a/modules/crypto/md2-buffer-tests
+++ b/modules/crypto/md2-buffer-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-md2-buffer.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/md4-buffer-tests b/modules/crypto/md4-buffer-tests
index 8238db40db..fec85a5d58 100644
--- a/modules/crypto/md4-buffer-tests
+++ b/modules/crypto/md4-buffer-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-md4-buffer.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/md5-buffer-tests b/modules/crypto/md5-buffer-tests
index 03ba4ebffd..d8ad22c42f 100644
--- a/modules/crypto/md5-buffer-tests
+++ b/modules/crypto/md5-buffer-tests
@@ -8,6 +8,7 @@ Depends-on:
 c99
 getrusage
 gettimeofday
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/sha1-buffer-tests b/modules/crypto/sha1-buffer-tests
index 7cf1ec385a..1210d23785 100644
--- a/modules/crypto/sha1-buffer-tests
+++ b/modules/crypto/sha1-buffer-tests
@@ -8,6 +8,7 @@ Depends-on:
 c99
 getrusage
 gettimeofday
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/sha256-buffer-tests b/modules/crypto/sha256-buffer-tests
index 1fae2f412e..9f6405a95c 100644
--- a/modules/crypto/sha256-buffer-tests
+++ b/modules/crypto/sha256-buffer-tests
@@ -10,6 +10,7 @@ Depends-on:
 c99
 getrusage
 gettimeofday
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/sha512-buffer-tests b/modules/crypto/sha512-buffer-tests
index ceabf0382d..93017d877f 100644
--- a/modules/crypto/sha512-buffer-tests
+++ b/modules/crypto/sha512-buffer-tests
@@ -10,6 +10,7 @@ Depends-on:
 c99
 getrusage
 gettimeofday
+memeq
 
 configure.ac:
 
diff --git a/modules/crypto/sm3-buffer-tests b/modules/crypto/sm3-buffer-tests
index 983a22d46d..d1c17a6d25 100644
--- a/modules/crypto/sm3-buffer-tests
+++ b/modules/crypto/sm3-buffer-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-sm3-buffer.c
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/pthread-thread-tests b/modules/pthread-thread-tests
index fde0e0ade6..30a0b28918 100644
--- a/modules/pthread-thread-tests
+++ b/modules/pthread-thread-tests
@@ -3,6 +3,7 @@ tests/test-pthread-thread.c
 tests/macros.h
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/thrd-tests b/modules/thrd-tests
index c726a8df4b..f683417883 100644
--- a/modules/thrd-tests
+++ b/modules/thrd-tests
@@ -5,6 +5,7 @@ tests/test-thrd_exit.c
 tests/macros.h
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/modules/thread-tests b/modules/thread-tests
index 38608f30e2..108730a847 100644
--- a/modules/thread-tests
+++ b/modules/thread-tests
@@ -4,6 +4,7 @@ tests/test-thread_create.c
 tests/macros.h
 
 Depends-on:
+memeq
 
 configure.ac:
 
diff --git a/tests/test-arcfour.c b/tests/test-arcfour.c
index 19d89d95bf..84b7764a6a 100644
--- a/tests/test-arcfour.c
+++ b/tests/test-arcfour.c
@@ -35,7 +35,7 @@ main (int argc, char *argv[])
 
   arcfour_setkey (&ctx, key_1, sizeof (key_1));
   arcfour_stream (&ctx, plaintext_1, scratch, sizeof (plaintext_1));
-  if (memcmp (scratch, ciphertext_1, sizeof (ciphertext_1)))
+  if (!memeq (scratch, ciphertext_1, sizeof (ciphertext_1)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < 5; i++)
@@ -51,7 +51,7 @@ main (int argc, char *argv[])
 
   arcfour_setkey (&ctx, key_1, sizeof (key_1));
   arcfour_stream (&ctx, scratch, scratch, sizeof (plaintext_1));
-  if (memcmp (scratch, plaintext_1, sizeof (plaintext_1)))
+  if (!memeq (scratch, plaintext_1, sizeof (plaintext_1)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < 5; i++)
diff --git a/tests/test-arctwo.c b/tests/test-arctwo.c
index 5e69702bf8..7e666c4e9e 100644
--- a/tests/test-arctwo.c
+++ b/tests/test-arctwo.c
@@ -77,42 +77,42 @@ main (int argc, char *argv[])
   arctwo_setkey_ekb (&ctx, sizeof (key_1), key_1, 0);
   arctwo_encrypt (&ctx, plaintext_1, scratch, ARCTWO_BLOCK_SIZE);
 
-  if (memcmp (scratch, ciphertext_1, sizeof (ciphertext_1)))
+  if (!memeq (scratch, ciphertext_1, sizeof (ciphertext_1)))
     return 1;
 
   arctwo_setkey_ekb (&ctx, sizeof (key_1), key_1, 0);
   arctwo_decrypt (&ctx, scratch, scratch, ARCTWO_BLOCK_SIZE);
-  if (memcmp (scratch, plaintext_1, sizeof (plaintext_1)))
+  if (!memeq (scratch, plaintext_1, sizeof (plaintext_1)))
     return 1;
 
   /* Second test. */
   arctwo_setkey_ekb (&ctx, sizeof (key_2), key_2, 0);
   arctwo_encrypt (&ctx, plaintext_2, scratch, ARCTWO_BLOCK_SIZE);
-  if (memcmp (scratch, ciphertext_2, sizeof (ciphertext_2)))
+  if (!memeq (scratch, ciphertext_2, sizeof (ciphertext_2)))
     return 1;
 
   arctwo_setkey_ekb (&ctx, sizeof (key_2), key_2, 0);
   arctwo_decrypt (&ctx, scratch, scratch, ARCTWO_BLOCK_SIZE);
-  if (memcmp (scratch, plaintext_2, sizeof (plaintext_2)))
+  if (!memeq (scratch, plaintext_2, sizeof (plaintext_2)))
     return 1;
 
   /* Third test. */
   arctwo_setkey_ekb (&ctx, sizeof (key_3), key_3, 0);
   arctwo_encrypt (&ctx, plaintext_3, scratch, ARCTWO_BLOCK_SIZE);
 
-  if (memcmp (scratch, ciphertext_3, sizeof (ciphertext_3)))
+  if (!memeq (scratch, ciphertext_3, sizeof (ciphertext_3)))
     return 1;
 
   arctwo_setkey_ekb (&ctx, sizeof (key_3), key_3, 0);
   arctwo_decrypt (&ctx, scratch, scratch, ARCTWO_BLOCK_SIZE);
-  if (memcmp (scratch, plaintext_3, sizeof (plaintext_3)))
+  if (!memeq (scratch, plaintext_3, sizeof (plaintext_3)))
     return 1;
 
   /* Fourth test. */
   arctwo_setkey_ekb (&ctx, sizeof (key_4), key_4, 63);
   arctwo_encrypt (&ctx, plaintext_4, scratch, ARCTWO_BLOCK_SIZE);
 
-  if (memcmp (scratch, ciphertext_4, sizeof (ciphertext_4)))
+  if (!memeq (scratch, ciphertext_4, sizeof (ciphertext_4)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < sizeof (ciphertext_4); i++)
@@ -126,14 +126,14 @@ main (int argc, char *argv[])
 
   arctwo_setkey_ekb (&ctx, sizeof (key_4), key_4, 63);
   arctwo_decrypt (&ctx, scratch, scratch, ARCTWO_BLOCK_SIZE);
-  if (memcmp (scratch, plaintext_4, sizeof (plaintext_4)))
+  if (!memeq (scratch, plaintext_4, sizeof (plaintext_4)))
     return 1;
 
   /* Fifth test. */
   arctwo_setkey_ekb (&ctx, sizeof (key_5), key_5, 64);
   arctwo_encrypt (&ctx, plaintext_5, scratch, ARCTWO_BLOCK_SIZE);
 
-  if (memcmp (scratch, ciphertext_5, sizeof (ciphertext_5)))
+  if (!memeq (scratch, ciphertext_5, sizeof (ciphertext_5)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < sizeof (ciphertext_5); i++)
@@ -147,14 +147,14 @@ main (int argc, char *argv[])
 
   arctwo_setkey_ekb (&ctx, sizeof (key_5), key_5, 64);
   arctwo_decrypt (&ctx, scratch, scratch, ARCTWO_BLOCK_SIZE);
-  if (memcmp (scratch, plaintext_5, sizeof (plaintext_5)))
+  if (!memeq (scratch, plaintext_5, sizeof (plaintext_5)))
     return 1;
 
   /* Sixth test. */
   arctwo_setkey_ekb (&ctx, 8, key_6, 64);
   arctwo_encrypt (&ctx, plaintext_6, scratch, ARCTWO_BLOCK_SIZE);
 
-  if (memcmp (scratch, ciphertext_6, sizeof (ciphertext_6)))
+  if (!memeq (scratch, ciphertext_6, sizeof (ciphertext_6)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < sizeof (ciphertext_6); i++)
@@ -168,7 +168,7 @@ main (int argc, char *argv[])
 
   arctwo_setkey_ekb (&ctx, sizeof (key_6), key_6, 64);
   arctwo_decrypt (&ctx, scratch, scratch, ARCTWO_BLOCK_SIZE);
-  if (memcmp (scratch, plaintext_6, sizeof (plaintext_6)))
+  if (!memeq (scratch, plaintext_6, sizeof (plaintext_6)))
     return 1;
 
   return 0;
diff --git a/tests/test-des.c b/tests/test-des.c
index 6009ec1af8..1864045ec6 100644
--- a/tests/test-des.c
+++ b/tests/test-des.c
@@ -47,7 +47,7 @@ main (int argc, char *argv[])
         memcpy (key, temp3, 8);
         memcpy (input, temp1, 8);
       }
-    if (memcmp (temp3, result, 8))
+    if (!memeq (temp3, result, 8))
       return 1;
   }
 
@@ -71,7 +71,7 @@ main (int argc, char *argv[])
         gl_3des_set3keys (&des3, key1, input, key2);
         gl_3des_ecb_encrypt (&des3, input, input);
       }
-    if (memcmp (input, result, 8))
+    if (!memeq (input, result, 8))
       return 1;
   }
 
@@ -197,13 +197,13 @@ main (int argc, char *argv[])
                           testdata[i].key + 8, testdata[i].key + 16);
 
         gl_3des_ecb_encrypt (&des3, testdata[i].plain, result);
-        if (memcmp (testdata[i].cipher, result, 8))
+        if (!memeq (testdata[i].cipher, result, 8))
           {
             return 1;
           }
 
         gl_3des_ecb_decrypt (&des3, testdata[i].cipher, result);
-        if (memcmp (testdata[i].plain, result, 8))
+        if (!memeq (testdata[i].plain, result, 8))
           {
             return 1;
           }
diff --git a/tests/test-gc-arcfour.c b/tests/test-gc-arcfour.c
index c47d3f74e8..00ddeff2e6 100644
--- a/tests/test-gc-arcfour.c
+++ b/tests/test-gc-arcfour.c
@@ -54,7 +54,7 @@ main (int argc, char *argv[])
   if (rc != GC_OK)
     return 1;
 
-  if (memcmp (scratch, ciphertext_1, sizeof (ciphertext_1)))
+  if (!memeq (scratch, ciphertext_1, sizeof (ciphertext_1)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < 5; i++)
@@ -76,7 +76,7 @@ main (int argc, char *argv[])
   if (rc != GC_OK)
     return 1;
 
-  if (memcmp (scratch, plaintext_1, sizeof (plaintext_1)))
+  if (!memeq (scratch, plaintext_1, sizeof (plaintext_1)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < 5; i++)
diff --git a/tests/test-gc-arctwo.c b/tests/test-gc-arctwo.c
index 35493427c2..6263fe4dad 100644
--- a/tests/test-gc-arctwo.c
+++ b/tests/test-gc-arctwo.c
@@ -56,7 +56,7 @@ main (int argc, char *argv[])
   if (rc != GC_OK)
     return 1;
 
-  if (memcmp (scratch, ciphertext, sizeof (ciphertext)))
+  if (!memeq (scratch, ciphertext, sizeof (ciphertext)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < 5; i++)
@@ -78,7 +78,7 @@ main (int argc, char *argv[])
   if (rc != GC_OK)
     return 1;
 
-  if (memcmp (scratch, plaintext, sizeof (plaintext)))
+  if (!memeq (scratch, plaintext, sizeof (plaintext)))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < 5; i++)
diff --git a/tests/test-gc-des.c b/tests/test-gc-des.c
index d74f63b22d..9e350a2c71 100644
--- a/tests/test-gc-des.c
+++ b/tests/test-gc-des.c
@@ -80,7 +80,7 @@ main (int argc, char *argv[])
 
         ctx_array[i] = ctx;
       }
-    if (memcmp (temp3, result, 8))
+    if (!memeq (temp3, result, 8))
       return 1;
 
     for (int i = 0; i < 64; ++i)
diff --git a/tests/test-md2-buffer.c b/tests/test-md2-buffer.c
index e71b314542..d4e19e1df8 100644
--- a/tests/test-md2-buffer.c
+++ b/tests/test-md2-buffer.c
@@ -34,8 +34,7 @@ main (int argc, char *argv[])
     "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47\x94\x0b";
   char buf[MD2_DIGEST_SIZE];
 
-  if (memcmp (md2_buffer (in1, strlen (in1), buf), out1, MD2_DIGEST_SIZE) !=
-      0)
+  if (!memeq (md2_buffer (in1, strlen (in1), buf), out1, MD2_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < MD2_DIGEST_SIZE; i++)
@@ -47,8 +46,7 @@ main (int argc, char *argv[])
       return 1;
     }
 
-  if (memcmp (md2_buffer (in2, strlen (in2), buf), out2, MD2_DIGEST_SIZE) !=
-      0)
+  if (!memeq (md2_buffer (in2, strlen (in2), buf), out2, MD2_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < MD2_DIGEST_SIZE; i++)
diff --git a/tests/test-md4-buffer.c b/tests/test-md4-buffer.c
index 8104ebb7b1..940806edeb 100644
--- a/tests/test-md4-buffer.c
+++ b/tests/test-md4-buffer.c
@@ -35,8 +35,7 @@ main (int argc, char *argv[])
     "\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd\xee\xa8\xed\x63\xdf\x41\x2d\xa9";
   char buf[MD4_DIGEST_SIZE];
 
-  if (memcmp (md4_buffer (in1, strlen (in1), buf), out1, MD4_DIGEST_SIZE) !=
-      0)
+  if (!memeq (md4_buffer (in1, strlen (in1), buf), out1, MD4_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < MD4_DIGEST_SIZE; i++)
@@ -48,8 +47,7 @@ main (int argc, char *argv[])
       return 1;
     }
 
-  if (memcmp (md4_buffer (in2, strlen (in2), buf), out2, MD4_DIGEST_SIZE) !=
-      0)
+  if (!memeq (md4_buffer (in2, strlen (in2), buf), out2, MD4_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < MD4_DIGEST_SIZE; i++)
diff --git a/tests/test-md5-buffer.c b/tests/test-md5-buffer.c
index 9aaec260d2..f0fa46b887 100644
--- a/tests/test-md5-buffer.c
+++ b/tests/test-md5-buffer.c
@@ -37,7 +37,7 @@ main (void)
     "\xF9\x6B\x69\x7D\x7C\xB7\x93\x8D\x52\x5A\x2F\x31\xAA\xF1\x61\xD0";
   char buf[MD5_DIGEST_SIZE];
 
-  if (memcmp (md5_buffer (in1, strlen (in1), buf), out1, MD5_DIGEST_SIZE) != 0)
+  if (!memeq (md5_buffer (in1, strlen (in1), buf), out1, MD5_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < MD5_DIGEST_SIZE; i++)
@@ -49,7 +49,7 @@ main (void)
       return 1;
     }
 
-  if (memcmp (md5_buffer (in2, strlen (in2), buf), out2, MD5_DIGEST_SIZE) != 0)
+  if (!memeq (md5_buffer (in2, strlen (in2), buf), out2, MD5_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < MD5_DIGEST_SIZE; i++)
diff --git a/tests/test-pthread-thread.c b/tests/test-pthread-thread.c
index c74553fa9c..51359c27f4 100644
--- a/tests/test-pthread-thread.c
+++ b/tests/test-pthread-thread.c
@@ -51,9 +51,8 @@ main ()
       /* Check that pthread_self () has the same value before than after the
          first call to pthread_create ().  */
       main_thread_after = pthread_self ();
-      ASSERT (memcmp (&main_thread_before, &main_thread_after,
-                      sizeof (pthread_t))
-              == 0);
+      ASSERT (memeq (&main_thread_before, &main_thread_after,
+                     sizeof (pthread_t)));
 
       ASSERT (pthread_join (worker_thread, &ret) == 0);
 
diff --git a/tests/test-sha1-buffer.c b/tests/test-sha1-buffer.c
index 0dc0559b7a..efeae28735 100644
--- a/tests/test-sha1-buffer.c
+++ b/tests/test-sha1-buffer.c
@@ -30,8 +30,7 @@ main (void)
     "\x32\x2e\x93\xa0\x15\xbc\xf8\x68\xe3\x24\xd5\x6a";
   char buf[SHA1_DIGEST_SIZE];
 
-  if (memcmp (sha1_buffer (in1, strlen (in1), buf),
-              out1, SHA1_DIGEST_SIZE) != 0)
+  if (!memeq (sha1_buffer (in1, strlen (in1), buf), out1, SHA1_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < SHA1_DIGEST_SIZE; i++)
diff --git a/tests/test-sha224-buffer.c b/tests/test-sha224-buffer.c
index 45f9405d7f..f8063a5b86 100644
--- a/tests/test-sha224-buffer.c
+++ b/tests/test-sha224-buffer.c
@@ -33,8 +33,7 @@ main (void)
     "\x5b\xdf\x7e\x27\xa1\xb7\x00\xf4\x62\x89\x41\x84";
   char buf[SHA224_DIGEST_SIZE];
 
-  if (memcmp (sha224_buffer (in1, strlen (in1), buf),
-              out1, SHA224_DIGEST_SIZE) != 0)
+  if (!memeq (sha224_buffer (in1, strlen (in1), buf), out1, SHA224_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < SHA224_DIGEST_SIZE; i++)
diff --git a/tests/test-sha256-buffer.c b/tests/test-sha256-buffer.c
index e5134b1a22..9c29e0b948 100644
--- a/tests/test-sha256-buffer.c
+++ b/tests/test-sha256-buffer.c
@@ -33,8 +33,7 @@ main (void)
     "\x89\xaf\xfa\x91\x9c\x8a\x85\xb7\x19\x8d\x8b\x15\xaf\xa3\x4b\x2c";
   char buf[SHA256_DIGEST_SIZE];
 
-  if (memcmp (sha256_buffer (in1, strlen (in1), buf),
-              out1, SHA256_DIGEST_SIZE) != 0)
+  if (!memeq (sha256_buffer (in1, strlen (in1), buf), out1, SHA256_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < SHA256_DIGEST_SIZE; i++)
diff --git a/tests/test-sha384-buffer.c b/tests/test-sha384-buffer.c
index 1fd6d94226..685ba7f87b 100644
--- a/tests/test-sha384-buffer.c
+++ b/tests/test-sha384-buffer.c
@@ -34,8 +34,7 @@ main (void)
     "\x74\x8d\x80\x99\xfb\x05\xb5\x22\xa3\x8f\x29\x1c\xea\xdd\x7a\x82";
   char buf[SHA384_DIGEST_SIZE];
 
-  if (memcmp (sha384_buffer (in1, strlen (in1), buf),
-              out1, SHA384_DIGEST_SIZE) != 0)
+  if (!memeq (sha384_buffer (in1, strlen (in1), buf), out1, SHA384_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < SHA384_DIGEST_SIZE; i++)
diff --git a/tests/test-sha512-buffer.c b/tests/test-sha512-buffer.c
index 42fd9a1021..5fa6d5193c 100644
--- a/tests/test-sha512-buffer.c
+++ b/tests/test-sha512-buffer.c
@@ -35,8 +35,7 @@ main (void)
     "\xac\x8a\xf9\x83\x9c\x35\x92\x94\x2d\xb7\xb4\xb4\x08\x2e\x7f\xe2";
   char buf[SHA512_DIGEST_SIZE];
 
-  if (memcmp (sha512_buffer (in1, strlen (in1), buf),
-              out1, SHA512_DIGEST_SIZE) != 0)
+  if (!memeq (sha512_buffer (in1, strlen (in1), buf), out1, SHA512_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < SHA512_DIGEST_SIZE; i++)
diff --git a/tests/test-sm3-buffer.c b/tests/test-sm3-buffer.c
index 33e628e30d..3310b6592c 100644
--- a/tests/test-sm3-buffer.c
+++ b/tests/test-sm3-buffer.c
@@ -27,8 +27,7 @@ test (const char *in, const char *out)
 {
   char buf[SM3_DIGEST_SIZE];
 
-  if (memcmp (sm3_buffer (in, strlen (in), buf),
-              out, SM3_DIGEST_SIZE) != 0)
+  if (!memeq (sm3_buffer (in, strlen (in), buf), out, SM3_DIGEST_SIZE))
     {
       printf ("expected:\n");
       for (size_t i = 0; i < SM3_DIGEST_SIZE; i++)
diff --git a/tests/test-thrd_create.c b/tests/test-thrd_create.c
index f06e71ddb3..3905e07ca0 100644
--- a/tests/test-thrd_create.c
+++ b/tests/test-thrd_create.c
@@ -51,9 +51,7 @@ main ()
       /* Check that thrd_current () has the same value before than after the
          first call to thrd_create ().  */
       main_thread_after = thrd_current ();
-      ASSERT (memcmp (&main_thread_before, &main_thread_after,
-                      sizeof (thrd_t))
-              == 0);
+      ASSERT (memeq (&main_thread_before, &main_thread_after, sizeof (thrd_t)));
 
       ASSERT (thrd_join (worker_thread, &ret) == thrd_success);
 
diff --git a/tests/test-thrd_exit.c b/tests/test-thrd_exit.c
index 006e83bb40..1b5a8c2868 100644
--- a/tests/test-thrd_exit.c
+++ b/tests/test-thrd_exit.c
@@ -55,9 +55,7 @@ main ()
       /* Check that thrd_current () has the same value before than after the
          first call to thrd_create ().  */
       main_thread_after = thrd_current ();
-      ASSERT (memcmp (&main_thread_before, &main_thread_after,
-                      sizeof (thrd_t))
-              == 0);
+      ASSERT (memeq (&main_thread_before, &main_thread_after, sizeof (thrd_t)));
 
       ASSERT (thrd_join (worker_thread, &ret) == thrd_success);
 
diff --git a/tests/test-thread_create.c b/tests/test-thread_create.c
index 44bfd7aad7..f16e38748c 100644
--- a/tests/test-thread_create.c
+++ b/tests/test-thread_create.c
@@ -51,9 +51,8 @@ main ()
       /* Check that gl_thread_self () has the same value before than after the
          first call to gl_thread_create ().  */
       main_thread_after = gl_thread_self ();
-      ASSERT (memcmp (&main_thread_before, &main_thread_after,
-                      sizeof (gl_thread_t))
-              == 0);
+      ASSERT (memeq (&main_thread_before, &main_thread_after,
+                     sizeof (gl_thread_t)));
 
       gl_thread_join (worker_thread, &ret);
 
-- 
2.52.0

Reply via email to