]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
stringeq: prefer memeq to memcmp in other modules
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 17 Sep 2025 01:57:41 +0000 (18:57 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 17 Sep 2025 15:20:24 +0000 (08:20 -0700)
* lib/argmatch.c, lib/argmatch.h, lib/backupfile.c, lib/bcp47.c:
* lib/boot-time.c, lib/csharpcomp.c, lib/csharpexec.c:
* lib/file-has-acl.c, lib/gen-uni-tables.c, lib/get_ppid_of.c:
* lib/get_progname_of.c, lib/getlogin_r.c, lib/getprogname.c:
* lib/getumask.c, lib/isnan.c, lib/mbchar.h, lib/mem-hash-map.c:
* lib/memcoll.c, lib/progname.c, lib/progreloc.c:
* lib/pthread_sigmask.c, lib/quotearg.c, lib/readutmp.c:
* lib/same.c, lib/signbitd.c, lib/signbitf.c, lib/signbitl.c:
* lib/string-desc.c, lib/string.c, lib/string.in.h:
* lib/unictype/3level.h, lib/unictype/3levelbit.h:
* lib/uniname/uniname.c, lib/vc-mtime.c:
Prefer memeq to memcmp when either will do.
Do not make this change to files shared with glibc.
Do not make the change to test files, at least not for now.
* lib/gen-uni-tables.c (memeq): New static function, in same style.
* modules/argmatch, modules/backupfile, modules/bcp47:
* modules/boot-time, modules/csharpcomp, modules/csharpexec:
* modules/file-has-acl:
* modules/get_ppid_of, modules/get_progname_of:
* modules/getlogin_r, modules/getprogname, modules/getumask:
* modules/isnan, modules/mbchar, modules/mem-hash-map:
* modules/memcoll, modules/progname, modules/pthread_sigmask:
* modules/quotearg, modules/readutmp, modules/relocatable-prog:
* modules/relocatable-prog-wrapper, modules/same, modules/signbit:
* modules/string-desc, modules/stringeq, modules/uniname/uniname:
* modules/vc-mtime:
(Depends-on): Add stringeq.

60 files changed:
ChangeLog
lib/argmatch.c
lib/argmatch.h
lib/backupfile.c
lib/bcp47.c
lib/boot-time.c
lib/csharpcomp.c
lib/csharpexec.c
lib/file-has-acl.c
lib/gen-uni-tables.c
lib/get_ppid_of.c
lib/get_progname_of.c
lib/getlogin_r.c
lib/getprogname.c
lib/getumask.c
lib/isnan.c
lib/mbchar.h
lib/mem-hash-map.c
lib/memcoll.c
lib/progname.c
lib/progreloc.c
lib/pthread_sigmask.c
lib/quotearg.c
lib/readutmp.c
lib/same.c
lib/signbitd.c
lib/signbitf.c
lib/signbitl.c
lib/string-desc.c
lib/unictype/3level.h
lib/unictype/3levelbit.h
lib/uniname/uniname.c
lib/vc-mtime.c
modules/argmatch
modules/backupfile
modules/bcp47
modules/boot-time
modules/csharpcomp
modules/csharpexec
modules/file-has-acl
modules/get_ppid_of
modules/get_progname_of
modules/getlogin_r
modules/getprogname
modules/getumask
modules/isnan
modules/mbchar
modules/mem-hash-map
modules/memcoll
modules/progname
modules/pthread_sigmask
modules/quotearg
modules/readutmp
modules/relocatable-prog
modules/relocatable-prog-wrapper
modules/same
modules/signbit
modules/string-desc
modules/uniname/uniname
modules/vc-mtime

index a098c202086dca3b6fe322bd879e3f450a2c48d3..e99039ed819b07b9e231ff057216e3ace05a5eea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,34 @@
 2025-09-17  Paul Eggert  <eggert@cs.ucla.edu>
 
+       stringeq: prefer memeq to memcmp in other modules
+       * lib/argmatch.c, lib/argmatch.h, lib/backupfile.c, lib/bcp47.c:
+       * lib/boot-time.c, lib/csharpcomp.c, lib/csharpexec.c:
+       * lib/file-has-acl.c, lib/gen-uni-tables.c, lib/get_ppid_of.c:
+       * lib/get_progname_of.c, lib/getlogin_r.c, lib/getprogname.c:
+       * lib/getumask.c, lib/isnan.c, lib/mbchar.h, lib/mem-hash-map.c:
+       * lib/memcoll.c, lib/progname.c, lib/progreloc.c:
+       * lib/pthread_sigmask.c, lib/quotearg.c, lib/readutmp.c:
+       * lib/same.c, lib/signbitd.c, lib/signbitf.c, lib/signbitl.c:
+       * lib/string-desc.c, lib/string.c, lib/string.in.h:
+       * lib/unictype/3level.h, lib/unictype/3levelbit.h:
+       * lib/uniname/uniname.c, lib/vc-mtime.c:
+       Prefer memeq to memcmp when either will do.
+       Do not make this change to files shared with glibc.
+       Do not make the change to test files, at least not for now.
+       * lib/gen-uni-tables.c (memeq): New static function, in same style.
+       * modules/argmatch, modules/backupfile, modules/bcp47:
+       * modules/boot-time, modules/csharpcomp, modules/csharpexec:
+       * modules/file-has-acl:
+       * modules/get_ppid_of, modules/get_progname_of:
+       * modules/getlogin_r, modules/getprogname, modules/getumask:
+       * modules/isnan, modules/mbchar, modules/mem-hash-map:
+       * modules/memcoll, modules/progname, modules/pthread_sigmask:
+       * modules/quotearg, modules/readutmp, modules/relocatable-prog:
+       * modules/relocatable-prog-wrapper, modules/same, modules/signbit:
+       * modules/string-desc, modules/stringeq, modules/uniname/uniname:
+       * modules/vc-mtime:
+       (Depends-on): Add stringeq.
+
        stringeq: new module
        * MODULES.html.sh (func_all_modules): Add stringeq.
        * lib/string.c, modules/stringeq: New files.
index e9b7c66a723d6538fd3a83cb2bf2f86a408f4a33..4dcea99ccb1e7f144436b7f133eaac02f37f166e 100644 (file)
@@ -102,7 +102,7 @@ argmatch (const char *arg, const char *const *arglist,
             {
               /* Second nonexact match found.  */
               if (vallist == NULL
-                  || memcmp ((char const *) vallist + valsize * matchind,
+                  || !memeq ((char const *) vallist + valsize * matchind,
                              (char const *) vallist + valsize * i, valsize))
                 {
                   /* There is a real ambiguity, or we could not
@@ -165,7 +165,7 @@ argmatch_valid (const char *const *arglist,
   fputs (_("Valid arguments are:"), stderr);
   for (i = 0; arglist[i]; i++)
     if ((i == 0)
-        || memcmp (last_val, (char const *) vallist + valsize * i, valsize))
+        || !memeq (last_val, (char const *) vallist + valsize * i, valsize))
       {
         fprintf (stderr, "\n  - %s", quote (arglist[i]));
         last_val = (char const *) vallist + valsize * i;
@@ -219,7 +219,7 @@ argmatch_to_argument (const void *value,
   size_t i;
 
   for (i = 0; arglist[i]; i++)
-    if (!memcmp (value, (char const *) vallist + valsize * i, valsize))
+    if (memeq (value, (char const *) vallist + valsize * i, valsize))
       return arglist[i];
   return NULL;
 }
index 4eac4ac93876071fa86a5aaefcf974c271a3cf56..c242ebca9e17883738c29b238fad8b6ae8ecb4aa 100644 (file)
@@ -30,7 +30,7 @@
 # include <limits.h>
 # include <stddef.h>
 # include <stdio.h>
-# include <string.h> /* memcmp */
+# include <string.h> /* memeq */
 
 # include "gettext.h"
 # include "quote.h"
@@ -210,7 +210,7 @@ char const *argmatch_to_argument (void const *value,
           else if (res == -1)                                           \
             /* First nonexact match found.  */                          \
             res = i;                                                    \
-          else if (memcmp (&g->args[res].val, &g->args[i].val, size))   \
+          else if (!memeq (&g->args[res].val, &g->args[i].val, size))   \
             /* Second nonexact match found.  */                         \
             /* There is a real ambiguity, or we could not               \
                disambiguate. */                                         \
@@ -225,7 +225,7 @@ char const *argmatch_to_argument (void const *value,
     const argmatch_##Name##_group_type *g = &argmatch_##Name##_group;   \
     size_t size = argmatch_##Name##_size;                               \
     for (size_t i = 0; g->args[i].arg; i++)                             \
-      if (!memcmp (val, &g->args[i].val, size))                         \
+      if (memeq (val, &g->args[i].val, size))                           \
         return g->args[i].arg;                                          \
     return NULL;                                                        \
   }                                                                     \
@@ -242,7 +242,7 @@ char const *argmatch_to_argument (void const *value,
     fputs (dgettext (GNULIB_TEXT_DOMAIN, "Valid arguments are:"), out); \
     for (int i = 0; g->args[i].arg; i++)                                \
       if (i == 0                                                        \
-          || memcmp (&g->args[i-1].val, &g->args[i].val, size))         \
+          || !memeq (&g->args[i-1].val, &g->args[i].val, size))         \
         fprintf (out, "\n  - %s", quote (g->args[i].arg));              \
       else                                                              \
         fprintf (out, ", %s", quote (g->args[i].arg));                  \
@@ -281,7 +281,7 @@ char const *argmatch_to_argument (void const *value,
         else                                                            \
           /* Genuine argument, display it with its synonyms. */         \
           for (int j = 0; g->args[j].arg; ++j)                          \
-            if (! memcmp (&g->args[ival].val, &g->args[j].val, size))   \
+            if (memeq (&g->args[ival].val, &g->args[j].val, size))      \
               col += (col == 4 ? 0 : 2) + strlen (g->args[j].arg);      \
         if (res <= col)                                                 \
           res = col <= 20 ? col : 20;                                   \
@@ -312,7 +312,7 @@ char const *argmatch_to_argument (void const *value,
         else                                                            \
           /* Genuine argument, display it with its synonyms. */         \
           for (int j = 0; g->args[j].arg; ++j)                          \
-            if (! memcmp (&g->args[ival].val, &g->args[j].val, size))   \
+            if (memeq (&g->args[ival].val, &g->args[j].val, size))      \
               {                                                         \
                 if (!first                                              \
                     && screen_width < col + 2 + strlen (g->args[j].arg)) \
index 585268e0cb15517a306c3ccfbf53bc0db3e580df..cfbc901efe89dbe859dd0d82bbd3769147daf3e5 100644 (file)
@@ -239,7 +239,7 @@ numbered_backup (int dir_fd, char **buffer, idx_t buffer_size, idx_t filelen,
       if (_D_EXACT_NAMLEN (dp) < baselen + 4)
         continue;
 
-      if (memcmp (buf + base_offset, dp->d_name, baselen + 2) != 0)
+      if (!memeq (buf + base_offset, dp->d_name, baselen + 2))
         continue;
 
       char const *p = dp->d_name + baselen + 2;
index 46fd31b5d45132279686947cccd8932b9066681c..33a078c8a28f99f6ff93f5ac0ec6de9771082661 100644 (file)
@@ -124,27 +124,27 @@ static const struct script scripts[] =
 static const struct script *
 default_script_in_territory (const char language[2], const char territory[2])
 {
-  if (memcmp (language, "az", 2) == 0)
+  if (memeq (language, "az", 2))
     {
-      if (memcmp (territory, "AZ", 2) == 0)
+      if (memeq (territory, "AZ", 2))
         return &scripts[SCRIPT_LATIN];
-      else if (memcmp (territory, "IR", 2) == 0)
+      else if (memeq (territory, "IR", 2))
         return &scripts[SCRIPT_ARABIC];
     }
-  else if (memcmp (language, "ku", 2) == 0)
+  else if (memeq (language, "ku", 2))
     {
-      if (memcmp (territory, "IQ", 2) == 0
-          || memcmp (territory, "IR", 2) == 0)
+      if (memeq (territory, "IQ", 2)
+          || memeq (territory, "IR", 2))
         return &scripts[SCRIPT_ARABIC];
-      else if (memcmp (territory, "SY", 2) == 0
-               || memcmp (territory, "TR", 2) == 0)
+      else if (memeq (territory, "SY", 2)
+               || memeq (territory, "TR", 2))
         return &scripts[SCRIPT_LATIN];
     }
-  else if (memcmp (language, "pa", 2) == 0)
+  else if (memeq (language, "pa", 2))
     {
-      if (memcmp (territory, "PK", 2) == 0)
+      if (memeq (territory, "PK", 2))
         return &scripts[SCRIPT_ARABIC];
-      else if (memcmp (territory, "IN", 2) == 0)
+      else if (memeq (territory, "IN", 2))
         return &scripts[SCRIPT_GURMUKHI];
     }
   return NULL;
@@ -156,32 +156,32 @@ default_script_in_territory (const char language[2], const char territory[2])
 static const struct script *
 default_script_for_language2 (const char language[2])
 {
-  if (memcmp (language, "be", 2) == 0)
+  if (memeq (language, "be", 2))
      return &scripts[SCRIPT_CYRILLIC];
-   else if (memcmp (language, "bs", 2) == 0)
+   else if (memeq (language, "bs", 2))
      return &scripts[SCRIPT_LATIN];
-   else if (memcmp (language, "ha", 2) == 0)
+   else if (memeq (language, "ha", 2))
      return &scripts[SCRIPT_LATIN];
-   else if (memcmp (language, "kk", 2) == 0)
+   else if (memeq (language, "kk", 2))
      return &scripts[SCRIPT_CYRILLIC];
-   else if (memcmp (language, "ks", 2) == 0)
+   else if (memeq (language, "ks", 2))
      return &scripts[SCRIPT_ARABIC];
-   else if (memcmp (language, "mn", 2) == 0)
+   else if (memeq (language, "mn", 2))
      return &scripts[SCRIPT_CYRILLIC];
-   else if (memcmp (language, "sd", 2) == 0)
+   else if (memeq (language, "sd", 2))
      return &scripts[SCRIPT_ARABIC];
-   else if (memcmp (language, "sr", 2) == 0)
+   else if (memeq (language, "sr", 2))
      return &scripts[SCRIPT_CYRILLIC];
-   else if (memcmp (language, "uz", 2) == 0)
+   else if (memeq (language, "uz", 2))
      return &scripts[SCRIPT_LATIN];
-   else if (memcmp (language, "yi", 2) == 0)
+   else if (memeq (language, "yi", 2))
      return &scripts[SCRIPT_HEBREW];
    return NULL;
 }
 static const struct script *
 default_script_for_language3 (const char language[3])
 {
-   if (memcmp (language, "ber", 3) == 0)
+   if (memeq (language, "ber", 3))
      return &scripts[SCRIPT_LATIN];
    return NULL;
 }
@@ -254,14 +254,14 @@ xpg_to_bcp47 (char *bcp47, const char *xpg)
   /* Canonicalize the language.  */
   /* For Quechua, Microsoft uses the ISO 639-3 code "quz" instead of the
      ISO 639-1 code "qu".  */
-  if (language_len == 3 && memcmp (language_start, "quz", 3) == 0)
+  if (language_len == 3 && memeq (language_start, "quz", 3))
     {
       language_start = "qu";
       language_len = 2;
     }
   /* For Tamazight, Microsoft uses the ISO 639-3 code "tzm" instead of the
      ISO 639-2 code "ber".  */
-  else if (language_len == 3 && memcmp (language_start, "tzm", 3) == 0)
+  else if (language_len == 3 && memeq (language_start, "tzm", 3))
     {
       language_start = "ber";
       language_len = 3;
@@ -277,7 +277,7 @@ xpg_to_bcp47 (char *bcp47, const char *xpg)
       size_t i;
       for (i = 0; i < NUM_SCRIPTS; i++)
         if (strlen (scripts[i].name) == modifier_len
-            && memcmp (scripts[i].name, modifier_start, modifier_len) == 0)
+            && memeq (scripts[i].name, modifier_start, modifier_len))
           script_subtag = scripts[i].code;
       if (script_subtag == NULL)
         {
@@ -298,10 +298,10 @@ xpg_to_bcp47 (char *bcp47, const char *xpg)
             default_script_in_territory (language_start, territory_start);
           if (sp != NULL)
             script_subtag = sp->code;
-          else if (memcmp (language_start, "zh", 2) == 0)
+          else if (memeq (language_start, "zh", 2))
             {
-              if (memcmp (territory_start, "CN", 2) == 0
-                  || memcmp (territory_start, "SG", 2) == 0)
+              if (memeq (territory_start, "CN", 2)
+                  || memeq (territory_start, "SG", 2))
                 script_subtag = "Hans";
               else
                 script_subtag = "Hant";
@@ -314,7 +314,7 @@ xpg_to_bcp47 (char *bcp47, const char *xpg)
             default_script_for_language2 (language_start);
           if (sp != NULL)
             script_subtag = sp->code;
-          else if (memcmp (language_start, "iu", 2) == 0)
+          else if (memeq (language_start, "iu", 2))
             script_subtag = "Cans";
         }
       else if (language_len == 3)
@@ -323,7 +323,7 @@ xpg_to_bcp47 (char *bcp47, const char *xpg)
             default_script_for_language3 (language_start);
           if (sp != NULL)
             script_subtag = sp->code;
-          else if (memcmp (language_start, "nan", 3) == 0)
+          else if (memeq (language_start, "nan", 3))
             script_subtag = "Hant";
         }
     }
@@ -466,14 +466,14 @@ bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
   /* Canonicalize the language.  */
   /* For Quechua, Microsoft uses the ISO 639-3 code "quz" instead of the
      ISO 639-1 code "qu".  */
-  if (language_len == 3 && memcmp (xpg, "quz", 3) == 0)
+  if (language_len == 3 && memeq (xpg, "quz", 3))
     {
       language_len = 2;
       memcpy (xpg, "qu", language_len);
     }
   /* For Tamazight, Microsoft uses the ISO 639-3 code "tzm" instead of the
      ISO 639-2 code "ber".  */
-  else if (language_len == 3 && memcmp (xpg, "tzm", 3) == 0)
+  else if (language_len == 3 && memeq (xpg, "tzm", 3))
     {
       language_len = 3;
       memcpy (xpg, "ber", language_len);
@@ -517,7 +517,7 @@ bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
               if (strcmp (script, sp->name) == 0)
                 script = NULL;
             }
-          else if (memcmp (xpg, "zh", 2) == 0)
+          else if (memeq (xpg, "zh", 2))
             {
               /* "Hans" and "Hant" are not present in the scripts[] table,
                  therefore nothing to do here.  */
@@ -533,7 +533,7 @@ bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
               if (strcmp (script, sp->name) == 0)
                 script = NULL;
             }
-          else if (memcmp (xpg, "iu", 2) == 0)
+          else if (memeq (xpg, "iu", 2))
             {
               /* "Cans" is not present in the scripts[] table,
                  therefore nothing to do here.  */
@@ -548,7 +548,7 @@ bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
               if (strcmp (script, sp->name) == 0)
                 script = NULL;
             }
-          else if (memcmp (xpg, "nan", 3) == 0)
+          else if (memeq (xpg, "nan", 3))
             {
               /* "Hant" is not present in the scripts[] table,
                  therefore nothing to do here.  */
index 82c2a26f6bfb363be021245cd7de3843156f060a..65d7aeaa4ac0b6ec5cff2be46cabd0b2572e9c2d 100644 (file)
@@ -120,13 +120,13 @@ get_boot_time_uncached (struct timespec *p_boot_time)
         found_boot_time = ts;
 
 #   if defined __linux__ && !defined __ANDROID__
-      if (memcmp (UT_USER (ut), "runlevel", strlen ("runlevel") + 1) == 0
-          && memcmp (ut->ut_line, "~", strlen ("~") + 1) == 0)
+      if (memeq (UT_USER (ut), "runlevel", strlen ("runlevel") + 1)
+          && memeq (ut->ut_line, "~", strlen ("~") + 1))
         runlevel_ts = ts;
 #   endif
 #   if defined __minix
       if (UT_USER (ut)[0] == '\0'
-          && memcmp (ut->ut_line, "run-level ", strlen ("run-level ")) == 0)
+          && memeq (ut->ut_line, "run-level ", strlen ("run-level ")))
         runlevel_ts = ts;
 #   endif
     }
index bda064b686bb1e9d60aab0c2b4fba8e1c10a2482..50f8c80403372c660e4365b521b55fa1a829a218 100644 (file)
@@ -68,7 +68,7 @@ name_is_dll (const struct dirent *d)
   if (d->d_name[0] != '.')
     {
       size_t d_name_len = strlen (d->d_name);
-      if (d_name_len > 4 && memcmp (d->d_name + d_name_len - 4, ".dll", 4) == 0)
+      if (d_name_len > 4 && memeq (d->d_name + d_name_len - 4, ".dll", 4))
         /* Filter out files that start with a lowercase letter and files that
            contain the substring ".Native.", since on Windows these files
            produce an error "PE image doesn't contain managed metadata".  */
@@ -122,7 +122,7 @@ compile_csharp_using_mono (const char * const *sources,
               count++;
               if (count == 4)
                 {
-                  if (memcmp (c, "Mono", 4) == 0)
+                  if (memeq (c, "Mono", 4))
                     mcs_present = true;
                   c[0] = c[1]; c[1] = c[2]; c[2] = c[3];
                   count--;
@@ -192,8 +192,8 @@ compile_csharp_using_mono (const char * const *sources,
         {
           const char *source_file = sources[i];
           if (strlen (source_file) >= 10
-              && memcmp (source_file + strlen (source_file) - 10, ".resources",
-                         10) == 0)
+              && memeq (source_file + strlen (source_file) - 10,
+                        ".resources", 10))
             {
               char *option = (char *) xmalloca (10 + strlen (source_file) + 1);
 
@@ -239,7 +239,7 @@ compile_csharp_using_mono (const char * const *sources,
       l = (l + 1) % 2;
       if (line[l] != NULL
           && !(linelen[l] >= 21
-               && memcmp (line[l], "Compilation succeeded", 21) == 0))
+               && memeq (line[l], "Compilation succeeded", 21)))
         fwrite (line[l], 1, linelen[l], stderr);
       if (line[0] != NULL)
         free (line[0]);
@@ -399,7 +399,7 @@ compile_csharp_using_dotnet (const char * const *sources,
                 /* The line has the structure
                      Microsoft.SUBSYSTEM VERSION [DIRECTORY]  */
                 if (linelen > 22
-                    && memcmp (line, "Microsoft.NETCore.App ", 22) == 0)
+                    && memeq (line, "Microsoft.NETCore.App ", 22))
                   {
                     char *version = line + 22;
                     char *version_end = strchr (version, ' ');
@@ -613,10 +613,9 @@ compile_csharp_using_dotnet (const char * const *sources,
           char *source_file_converted = cygpath_w (source_file);
           *mallocedp++ = source_file_converted;
           if (strlen (source_file_converted) >= 10
-              && memcmp (source_file_converted
-                         + strlen (source_file_converted) - 10,
-                         ".resources",
-                         10) == 0)
+              && memeq ((source_file_converted
+                         + strlen (source_file_converted) - 10),
+                        ".resources", 10))
             {
               char *option =
                 (char *) xmalloc (10 + strlen (source_file_converted) + 1);
@@ -717,12 +716,12 @@ compile_csharp_using_dotnet (const char * const *sources,
                   count++;
                   if (count >= 7)
                     {
-                      if (memcmp (c, "chicken", 7) == 0)
+                      if (memeq (c, "chicken", 7))
                         seen_chicken = true;
                     }
                   if (count == 8)
                     {
-                      if (memcmp (c, "analyzer", 8) == 0)
+                      if (memeq (c, "analyzer", 8))
                         seen_analyzer = true;
                       c[0] = c[1]; c[1] = c[2]; c[2] = c[3]; c[3] = c[4];
                       c[4] = c[5]; c[5] = c[6]; c[6] = c[7];
@@ -805,10 +804,9 @@ compile_csharp_using_dotnet (const char * const *sources,
               char *source_file_converted = cygpath_w (source_file);
               *mallocedp++ = source_file_converted;
               if (strlen (source_file_converted) >= 10
-                  && memcmp (source_file_converted
-                             + strlen (source_file_converted) - 10,
-                             ".resources",
-                             10) == 0)
+                  && memeq ((source_file_converted
+                             + strlen (source_file_converted) - 10),
+                            ".resources", 10))
                 {
                   char *option =
                     (char *) xmalloc (10 + strlen (source_file_converted) + 1);
@@ -895,7 +893,7 @@ compile_csharp_using_sscli (const char * const *sources,
               count++;
               if (count == 7)
                 {
-                  if (memcmp (c, "chicken", 7) == 0)
+                  if (memeq (c, "chicken", 7))
                     csc_present = false;
                   c[0] = c[1]; c[1] = c[2]; c[2] = c[3];
                   c[3] = c[4]; c[4] = c[5]; c[5] = c[6];
@@ -977,10 +975,9 @@ compile_csharp_using_sscli (const char * const *sources,
           char *source_file_converted = cygpath_w (source_file);
           *mallocedp++ = source_file_converted;
           if (strlen (source_file_converted) >= 10
-              && memcmp (source_file_converted
-                         + strlen (source_file_converted) - 10,
-                         ".resources",
-                         10) == 0)
+              && memeq ((source_file_converted
+                         + strlen (source_file_converted) - 10),
+                        ".resources", 10))
             {
               char *option =
                 (char *) xmalloc (10 + strlen (source_file_converted) + 1);
@@ -1034,7 +1031,7 @@ compile_csharp_class (const char * const *sources,
 {
   bool output_is_library =
     (strlen (output_file) >= 4
-     && memcmp (output_file + strlen (output_file) - 4, ".dll", 4) == 0);
+     && memeq (output_file + strlen (output_file) - 4, ".dll", 4));
   int result;
 
   /* First try the C# implementation specified through --enable-csharp.  */
index 385242422933d31f8e11f6424f486f86e611f615..8e3f7983f0dbe5bf2aabbe5a71574f786d2b190d 100644 (file)
@@ -105,7 +105,7 @@ name_is_dll (const struct dirent *d)
   if (d->d_name[0] != '.')
     {
       size_t d_name_len = strlen (d->d_name);
-      if (d_name_len > 4 && memcmp (d->d_name + d_name_len - 4, ".dll", 4) == 0)
+      if (d_name_len > 4 && memeq (d->d_name + d_name_len - 4, ".dll", 4))
         return 1;
     }
   return 0;
@@ -327,7 +327,7 @@ execute_csharp_using_dotnet (const char *assembly_path,
       {
         size_t assembly_path_len = strlen (assembly_path);
         if (assembly_path_len > 4
-            && memcmp (assembly_path + (assembly_path_len - 4), ".exe", 4) == 0)
+            && memeq (assembly_path + (assembly_path_len - 4), ".exe", 4))
           assembly_path_len -= 4;
         char *p = runtimeconfig_filename;
         memcpy (p, assembly_path, assembly_path_len);
@@ -421,7 +421,7 @@ execute_csharp_using_dotnet (const char *assembly_path,
                     /* The line has the structure
                          Microsoft.SUBSYSTEM VERSION [DIRECTORY]  */
                     if (linelen > 22
-                        && memcmp (line, "Microsoft.NETCore.App ", 22) == 0)
+                        && memeq (line, "Microsoft.NETCore.App ", 22))
                       {
                         char *version = line + 22;
                         char *version_end = strchr (version, ' ');
index 0dc42a91b2875a9a190fc882fff1063551b9dc22..d2fa69a2834932980ca6f49ae95cffc413b90b78 100644 (file)
@@ -261,7 +261,7 @@ get_aclinfo (int fd, char const *name, struct aclinfo *ai, int flags)
                  first case, and ENODATA in the latter.  */
               if (r == 0)
                 scontext_err = ENOTSUP;
-              if (r == 10 && memcmp (ai->scontext, "unlabeled", 10) == 0)
+              if (r == 10 && memeq (ai->scontext, "unlabeled", 10))
                 {
                   freecon (ai->scontext);
                   scontext_err = ENODATA;
@@ -364,9 +364,9 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
       /* For a trivial ACL, max 6 (typically 3) ACEs, 3 allow, 3 deny.
          Check that there is at most one ACE of each TYPE and WHO.  */
       int who2
-        = (wholen == 6 && memcmp (xattr, "OWNER@", 6) == 0 ? 0
-           : wholen == 6 && memcmp (xattr, "GROUP@", 6) == 0 ? 2
-           : wholen == 9 && memcmp (xattr, "EVERYONE@", 9) == 0 ? 4
+        = (wholen == 6 && memeq (xattr, "OWNER@", 6) ? 0
+           : wholen == 6 && memeq (xattr, "GROUP@", 6) ? 2
+           : wholen == 9 && memeq (xattr, "EVERYONE@", 9) ? 4
            : -1);
       if (who2 < 0)
         return 1;
index e48094d0f791a3da07745c02ec9c3fae0abcd5c8..4dbe7f5f13b6ed141d0a2c49e6a6f0936437742a 100644 (file)
@@ -67,6 +67,12 @@ str_endswith (const char *string, const char *suffix)
   return len >= n && strcmp (string + len - n, suffix) == 0;
 }
 
+static bool
+memeq (void const *s1, void const *s2, size_t n)
+{
+  return !memcmp (s1, s2, n);
+}
+
 /* ========================================================================= */
 
 /* Reading UnicodeData.txt.  */
@@ -10539,7 +10545,7 @@ get_decomposition (unsigned int ch,
           assert (rangle != NULL);
           typelen = rangle + 1 - decomposition;
 #define TYPE(t1,t2) \
-          if (typelen == (sizeof (t1) - 1) && memcmp (decomposition, t1, typelen) == 0) \
+          if (typelen == (sizeof (t1) - 1) && memeq (decomposition, t1, typelen)) \
             type = t2; \
           else
           TYPE ("<font>", UC_DECOMP_FONT)
@@ -11426,20 +11432,20 @@ fill_casing_rules (const char *specialcasing_filename)
             {
               bool negate = false;
 
-              if (word_end - word_begin >= 4 && memcmp (word_begin, "Not_", 4) == 0)
+              if (word_end - word_begin >= 4 && memeq (word_begin, "Not_", 4))
                 {
                   word_begin += 4;
                   negate = true;
                 }
-              if (word_end - word_begin == 11 && memcmp (word_begin, "Final_Sigma", 11) == 0)
+              if (word_end - word_begin == 11 && memeq (word_begin, "Final_Sigma", 11))
                 context = SCC_FINAL_SIGMA;
-              else if (word_end - word_begin == 17 && memcmp (word_begin, "After_Soft_Dotted", 17) == 0)
+              else if (word_end - word_begin == 17 && memeq (word_begin, "After_Soft_Dotted", 17))
                 context = SCC_AFTER_SOFT_DOTTED;
-              else if (word_end - word_begin == 10 && memcmp (word_begin, "More_Above", 10) == 0)
+              else if (word_end - word_begin == 10 && memeq (word_begin, "More_Above", 10))
                 context = SCC_MORE_ABOVE;
-              else if (word_end - word_begin == 10 && memcmp (word_begin, "Before_Dot", 10) == 0)
+              else if (word_end - word_begin == 10 && memeq (word_begin, "Before_Dot", 10))
                 context = SCC_BEFORE_DOT;
-              else if (word_end - word_begin == 7 && memcmp (word_begin, "After_I", 7) == 0)
+              else if (word_end - word_begin == 7 && memeq (word_begin, "After_I", 7))
                 context = SCC_AFTER_I;
               else
                 {
index ad940937b7f64d8e50156614eeba25b11d2c0dbc..83df0065e6d855e66a104a7b78879d8f1f8be7a1 100644 (file)
@@ -97,7 +97,7 @@ get_ppid_of (pid_t pid)
           /* Search for a line that starts with "PPid:".  */
           for (p = buf;;)
             {
-              if (bufend - p >= 5 && memcmp (p, "PPid:", 5) == 0)
+              if (bufend - p >= 5 && memeq (p, "PPid:", 5))
                 {
                   unsigned int ppid = 0;
                   if (sscanf (p + 5, "%u", &ppid) > 0)
index c8b9b87798030fc1a2d57df89220756321fdd4d1..0cc180e15d1095c215e3435f246d1fdc75dccd28 100644 (file)
@@ -341,7 +341,7 @@ get_progname_of (pid_t pid)
           else
             p = cmd;
           if (strlen (p) > PST_UCOMMLEN - 1
-              && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0)
+              && memeq (p, ucomm, PST_UCOMMLEN - 1))
             /* p is less truncated than ucomm.  */
             ;
           else
@@ -377,7 +377,7 @@ get_progname_of (pid_t pid)
               else
                 p = cmd;
               if (strlen (p) > PST_UCOMMLEN - 1
-                  && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0)
+                  && memeq (p, ucomm, PST_UCOMMLEN - 1))
                 /* p is less truncated than ucomm.  */
                 ;
               else
index ade819940ee208cf1af80b5b758a9f2c52231e5d..eb31008ea12cb1524a2423f4ba76c483885acbe5 100644 (file)
@@ -157,7 +157,7 @@ getlogin_r (char *name, size_t size)
             return ENOMEM;
           ret = getlogin_r (room, size + 1);
           /* The untruncated result should be the same as in the first call.  */
-          if (ret == 0 && memcmp (name, room, size) != 0)
+          if (ret == 0 && !memeq (name, room, size))
             /* The untruncated result would have been different.  */
             ret = ERANGE;
           freea (room);
index bf818b8b5c673eb7c14d6f774da373b26d3ba386..4da2159fe3b43145b0475db2328bba48a8652a5e 100644 (file)
@@ -129,7 +129,7 @@ getprogname (void)
               else
                 p = cmd;
               if (strlen (p) > PST_UCOMMLEN - 1
-                  && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0)
+                  && memeq (p, ucomm, PST_UCOMMLEN - 1))
                 /* p is less truncated than ucomm.  */
                 ;
               else
@@ -165,7 +165,7 @@ getprogname (void)
                   else
                     p = cmd;
                   if (strlen (p) > PST_UCOMMLEN - 1
-                      && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0)
+                      && memeq (p, ucomm, PST_UCOMMLEN - 1))
                     /* p is less truncated than ucomm.  */
                     ;
                   else
index b2a2afff2163a6d6bd761706f9e95bb5283c5bf5..f5daffb3aee53ae74563f1a84b5fda55197b350d 100644 (file)
@@ -80,7 +80,7 @@ getumask (void)
             for (;;)
               {
                 /* Here we're at the beginning of a line.  */
-                if (p_end - p > 8 && memcmp (p, "Umask:\t0", 8) == 0)
+                if (p_end - p > 8 && memeq (p, "Umask:\t0", 8))
                   {
                     unsigned int value = 0;
                     p += 8;
index c8a65caaa5bbc07e477021b80f4383a721ea1b31..915187bafa91d091b26e80065484ec3930a2050d 100644 (file)
@@ -156,8 +156,8 @@ FUNC (DOUBLE x)
     if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD])
          & (EXP_MASK << EXPBIT0_BIT))
         == 0)
-      return (memcmp (&m.value, &plus_inf, SIZE) != 0
-              && memcmp (&m.value, &minus_inf, SIZE) != 0);
+      return (!memeq (&m.value, &plus_inf, SIZE)
+              && !memeq (&m.value, &minus_inf, SIZE));
     else
       return 0;
   }
@@ -177,7 +177,7 @@ FUNC (DOUBLE x)
       memset (&m2.value, 0, SIZE);
       m1.value = x;
       m2.value = x + (x ? 0.0L : -0.0L);
-      if (memcmp (&m1.value, &m2.value, SIZE) != 0)
+      if (!memeq (&m1.value, &m2.value, SIZE))
         return 1;
 # endif
       return 0;
index 85422cd527fe3b8de5112e0caaa65d4837ceeb78..ba142425d48603464c39487c5a82a5d4adb1292e 100644 (file)
@@ -217,12 +217,12 @@ typedef struct mbchar mbchar_t;
   ((mbc1).wc_valid && (mbc2).wc_valid                                   \
    ? (mbc1).wc == (mbc2).wc                                             \
    : (mbc1).bytes == (mbc2).bytes                                       \
-     && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
+     && memeq ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes))
 #define mb_caseequal(mbc1, mbc2) \
   ((mbc1).wc_valid && (mbc2).wc_valid                                   \
    ? c32tolower ((mbc1).wc) == c32tolower ((mbc2).wc)                   \
    : (mbc1).bytes == (mbc2).bytes                                       \
-     && memcmp ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes) == 0)
+     && memeq ((mbc1).ptr, (mbc2).ptr, (mbc1).bytes))
 
 /* <ctype.h>, <wctype.h> classification.  */
 #define mb_isascii(mbc) \
index 1cd4f436cc39e3a9eaf06906d5d17cb783c63e46..23fc80fa89899b8c02f214b6868577899bb11f79 100644 (file)
@@ -129,7 +129,7 @@ lookup (const hash_table *htab,
   if (table[idx].used)
     {
       if (table[idx].used == hval && table[idx].keylen == keylen
-          && memcmp (table[idx].key, key, keylen) == 0)
+          && memeq (table[idx].key, key, keylen))
         return idx;
 
       /* Second hash function as suggested in [Knuth].  */
@@ -144,7 +144,7 @@ lookup (const hash_table *htab,
 
           /* If entry is found use it.  */
           if (table[idx].used == hval && table[idx].keylen == keylen
-              && memcmp (table[idx].key, key, keylen) == 0)
+              && memeq (table[idx].key, key, keylen))
             return idx;
         }
       while (table[idx].used);
index 591c3a836d736d4b0b9ae974503c93cd84cad099..e74358a454e6958e1d3656ba5d3d9461c12df33f 100644 (file)
@@ -71,7 +71,7 @@ memcoll (char *s1, size_t s1len, char *s2, size_t s2len)
      where the arguments are bytewise equal.  Otherwise, walk through
      the buffers using strcoll on each substring.  */
 
-  if (s1len == s2len && memcmp (s1, s2, s1len) == 0)
+  if (s1len == s2len && memeq (s1, s2, s1len))
     {
       errno = 0;
       diff = 0;
@@ -101,7 +101,7 @@ memcoll (char *s1, size_t s1len, char *s2, size_t s2len)
 int
 memcoll0 (char const *s1, size_t s1size, char const *s2, size_t s2size)
 {
-  if (s1size == s2size && memcmp (s1, s2, s1size) == 0)
+  if (s1size == s2size && memeq (s1, s2, s1size))
     {
       errno = 0;
       return 0;
index 4b0c9cc6ac51e8640777e31b962488fe0caa8754..adcde62ef30073d2062a309f0d39e622563aad43 100644 (file)
@@ -43,7 +43,7 @@ set_program_name (const char *argv0)
      Remove this "<dirname>/.libs/" or "<dirname>/.libs/lt-" prefix here.  */
   char const *slash = strrchr (argv0, '/');
   char const *base = slash ? slash + 1 : argv0;
-  if (7 <= base - argv0 && memcmp (base - 7, "/.libs/", 7) == 0)
+  if (7 <= base - argv0 && memeq (base - 7, "/.libs/", 7))
     {
       argv0 = base;
       if (strncmp (base, "lt-", 3) == 0)
index 17848589e8b20c38f7928064b23b1cab998dbcec..715e750e7a46ff8b0bb946619e6106f212293a23 100644 (file)
@@ -454,7 +454,7 @@ set_program_name_and_installdir (const char *argv0,
     size_t argv0_len = strlen (argv0);
     const size_t exeext_len = sizeof (EXEEXT) - sizeof ("");
     if (argv0_len > 4 + exeext_len)
-      if (memcmp (argv0 + argv0_len - exeext_len - 4, ".bin", 4) == 0)
+      if (memeq (argv0 + argv0_len - exeext_len - 4, ".bin", 4))
         {
           if (sizeof (EXEEXT) > sizeof (""))
             {
index 11216246166b6921ec49303079e746db59258f24..0d0a5c211da4dd1b31c3a1dec3eda91fe67ec125 100644 (file)
@@ -54,7 +54,7 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
          Don't cache the information: libpthread.so could be dynamically
          loaded after the program started and after pthread_sigmask was
          called for the first time.  */
-      if (memcmp (&omask_copy, &omask, sizeof omask) == 0
+      if (memeq (&omask_copy, &omask, sizeof omask)
           && pthread_sigmask (1729, &omask_copy, NULL) == 0)
         {
           /* pthread_sigmask is currently ineffective.  The program is not
index 325f3d9172b504a54ad468973cdbd13c065c3ea3..ded23c710f5e2c5d63f8f4a47e80bb68bc82c3ed 100644 (file)
@@ -410,7 +410,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
                      and when the quote string is more than 1 byte long.
                      If we do call strlen, save the result.  */
                   ? (argsize = strlen (arg)) : argsize))
-          && memcmp (arg + i, quote_string, quote_string_len) == 0)
+          && memeq (arg + i, quote_string, quote_string_len))
         {
           if (elide_outer_quotes)
             goto force_outer_quoting_style;
index e4ac91706096e7e910a520f0b84f65aa201ca0c5..1ddc4a51174a5bbbef19744d871c4dbef7c6407c 100644 (file)
@@ -394,14 +394,14 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
                    );
 #   if defined __linux__ && !defined __ANDROID__
       if (file_is_utmp
-          && memcmp (UT_USER (ut), "runlevel", strlen ("runlevel") + 1) == 0
-          && memcmp (ut->ut_line, "~", strlen ("~") + 1) == 0)
+          && memeq (UT_USER (ut), "runlevel", strlen ("runlevel") + 1)
+          && memeq (ut->ut_line, "~", strlen ("~") + 1))
         runlevel_ts = ts;
 #   endif
 #   if defined __minix
       if (file_is_utmp
           && UT_USER (ut)[0] == '\0'
-          && memcmp (ut->ut_line, "run-level ", strlen ("run-level ")) == 0)
+          && memeq (ut->ut_line, "run-level ", strlen ("run-level ")))
         runlevel_ts = ts;
 #   endif
     }
index 223a847938b9a7bf54adfdf4f8106d931c9a0eee..da6147cf3aa59cd04ca010e081e2f4f6ee1e49a9 100644 (file)
@@ -76,7 +76,7 @@ same_nameat (int source_dfd, char const *source,
   size_t dest_baselen = base_len (dest_basename);
   bool identical_basenames =
     (source_baselen == dest_baselen
-     && memcmp (source_basename, dest_basename, dest_baselen) == 0);
+     && memeq (source_basename, dest_basename, dest_baselen));
   bool compare_dirs = identical_basenames;
   bool same = false;
 
@@ -84,7 +84,7 @@ same_nameat (int source_dfd, char const *source,
   size_t slen_max = HAVE_LONG_FILE_NAMES ? 255 : _POSIX_NAME_MAX;
   size_t min_baselen = MIN (source_baselen, dest_baselen);
   if (slen_max <= min_baselen
-      && memcmp (source_basename, dest_basename, slen_max) == 0)
+      && memeq (source_basename, dest_basename, slen_max))
     compare_dirs = true;
 #endif
 
@@ -122,8 +122,7 @@ same_nameat (int source_dfd, char const *source,
                 destdir_errno = errno;
               else
                 same = (name_max <= min_baselen
-                        && (memcmp (source_basename, dest_basename, name_max)
-                            == 0));
+                        && memeq (source_basename, dest_basename, name_max));
             }
         }
       close (destdir_fd);
index 569d7a69e49b666e90a5a3ea093f0e6b7836e517..6cbfa1074237591aaf9cf16058ca5d8b874f6832 100644 (file)
@@ -56,7 +56,7 @@ gl_signbitd (double arg)
       /* Distinguish 0.0 and -0.0.  */
       static double plus_zero = 0.0;
       double arg_mem = arg;
-      return (memcmp (&plus_zero, &arg_mem, SIZEOF_DBL) != 0);
+      return !memeq (&plus_zero, &arg_mem, SIZEOF_DBL);
     }
   else
     return 0;
index c99dee7594b2d69a0ddf9f9bfc36bd0f13745589..d833b4b902511b5c64b99824c516206b52209246 100644 (file)
@@ -56,7 +56,7 @@ gl_signbitf (float arg)
       /* Distinguish 0.0f and -0.0f.  */
       static float plus_zero = 0.0f;
       float arg_mem = arg;
-      return (memcmp (&plus_zero, &arg_mem, SIZEOF_FLT) != 0);
+      return !memeq (&plus_zero, &arg_mem, SIZEOF_FLT);
     }
   else
     return 0;
index c925bc0cc6a1409d192b45a0f7105cf209eee93e..0b1854217cc45c9d0df36c6caf8c0153bc10581e 100644 (file)
@@ -56,7 +56,7 @@ gl_signbitl (long double arg)
       /* Distinguish 0.0L and -0.0L.  */
       static long double plus_zero = 0.0L;
       long double arg_mem = arg;
-      return (memcmp (&plus_zero, &arg_mem, SIZEOF_LDBL) != 0);
+      return !memeq (&plus_zero, &arg_mem, SIZEOF_LDBL);
     }
   else
     return 0;
index eb91d035cb6bb6d739f29328e8ec70d1c7a817c3..0ff0c4db6abe184170529f8dc4fd8ce21dc56ca3 100644 (file)
@@ -41,7 +41,7 @@ _sd_equals (idx_t a_nbytes, const char *a_data,
             idx_t b_nbytes, const char *b_data)
 {
   return (a_nbytes == b_nbytes
-          && (a_nbytes == 0 || memcmp (a_data, b_data, a_nbytes) == 0));
+          && (a_nbytes == 0 || memeq (a_data, b_data, a_nbytes)));
 }
 
 bool
@@ -50,7 +50,7 @@ _sd_startswith (idx_t s_nbytes, const char *s_data,
 {
   return (s_nbytes >= prefix_nbytes
           && (prefix_nbytes == 0
-              || memcmp (s_data, prefix_data, prefix_nbytes) == 0));
+              || memeq (s_data, prefix_data, prefix_nbytes)));
 }
 
 bool
@@ -59,8 +59,8 @@ _sd_endswith (idx_t s_nbytes, const char *s_data,
 {
   return (s_nbytes >= suffix_nbytes
           && (suffix_nbytes == 0
-              || memcmp (s_data + (s_nbytes - suffix_nbytes), suffix_data,
-                         suffix_nbytes) == 0));
+              || memeq (s_data + (s_nbytes - suffix_nbytes), suffix_data,
+                        suffix_nbytes)));
 }
 
 int
index a9752effbdee5f75e4f408c60d641c23888d5467..be8b9cf52aa17bbe9dd8f5b893a9cfcd782c4ef1 100644 (file)
@@ -222,8 +222,8 @@ CONCAT(TABLE,_finalize) (struct TABLE *t)
   for (j = 0; j < t->level3_size; j++)
     {
       for (i = 0; i < k; i++)
-        if (memcmp (&t->level3[i << t->p], &t->level3[j << t->p],
-                    (1 << t->p) * sizeof (ELEMENT)) == 0)
+        if (memeq (&t->level3[i << t->p], &t->level3[j << t->p],
+                   (1 << t->p) * sizeof (ELEMENT)))
           break;
       /* Relocate block j to block i.  */
       reorder3[j] = i;
@@ -246,8 +246,8 @@ CONCAT(TABLE,_finalize) (struct TABLE *t)
   for (j = 0; j < t->level2_size; j++)
     {
       for (i = 0; i < k; i++)
-        if (memcmp (&t->level2[i << t->q], &t->level2[j << t->q],
-                    (1 << t->q) * sizeof (uint32_t)) == 0)
+        if (memeq (&t->level2[i << t->q], &t->level2[j << t->q],
+                   (1 << t->q) * sizeof (uint32_t)))
           break;
       /* Relocate block j to block i.  */
       reorder2[j] = i;
index fb639981937c4337365ce98482157e051f6b297a..981efa9699735d0b6430a2c21d891fd3d98e1520 100644 (file)
@@ -218,8 +218,8 @@ CONCAT(TABLE,_finalize) (struct TABLE *t)
   for (j = 0; j < t->level3_size; j++)
     {
       for (i = 0; i < k; i++)
-        if (memcmp (&t->level3[i << t->p], &t->level3[j << t->p],
-                    (1 << t->p) * sizeof (uint32_t)) == 0)
+        if (memeq (&t->level3[i << t->p], &t->level3[j << t->p],
+                   (1 << t->p) * sizeof (uint32_t)))
           break;
       /* Relocate block j to block i.  */
       reorder3[j] = i;
@@ -242,8 +242,8 @@ CONCAT(TABLE,_finalize) (struct TABLE *t)
   for (j = 0; j < t->level2_size; j++)
     {
       for (i = 0; i < k; i++)
-        if (memcmp (&t->level2[i << t->q], &t->level2[j << t->q],
-                    (1 << t->q) * sizeof (uint32_t)) == 0)
+        if (memeq (&t->level2[i << t->q], &t->level2[j << t->q],
+                   (1 << t->q) * sizeof (uint32_t)))
           break;
       /* Relocate block j to block i.  */
       reorder2[j] = i;
index ad9407edd2a84a9c61ac81f4353693d87671d7f7..953b70df06b31994e9d66071bd3381255d28065f 100644 (file)
@@ -485,19 +485,19 @@ unicode_name_character (const char *name)
                               unsigned int index1;
 
                               for (index1 = 0; index1 < 19; index1++)
-                                if (memcmp (jamo_initial_short_name[index1], p1, n1) == 0
+                                if (memeq (jamo_initial_short_name[index1], p1, n1)
                                     && jamo_initial_short_name[index1][n1] == '\0')
                                   {
                                     unsigned int index2;
 
                                     for (index2 = 0; index2 < 21; index2++)
-                                      if (memcmp (jamo_medial_short_name[index2], p2, n2) == 0
+                                      if (memeq (jamo_medial_short_name[index2], p2, n2)
                                           && jamo_medial_short_name[index2][n2] == '\0')
                                         {
                                           unsigned int index3;
 
                                           for (index3 = 0; index3 < 28; index3++)
-                                            if (memcmp (jamo_final_short_name[index3], p3, n3) == 0
+                                            if (memeq (jamo_final_short_name[index3], p3, n3)
                                                 && jamo_final_short_name[index3][n3] == '\0')
                                               {
                                                 return 0xAC00 + (index1 * 21 + index2) * 28 + index3;
@@ -516,7 +516,7 @@ unicode_name_character (const char *name)
                       && words[1] == UNICODE_CHARNAME_WORD_COMPATIBILITY
                       && p1 + 14 <= ptr
                       && p1 + 15 >= ptr
-                      && memcmp (p1, "IDEOGRAPH-", 10) == 0)
+                      && memeq (p1, "IDEOGRAPH-", 10))
                     {
                       const char *p2 = p1 + 10;
 
@@ -553,7 +553,7 @@ unicode_name_character (const char *name)
                       && words[0] == UNICODE_CHARNAME_WORD_VARIATION
                       && p1 + 10 <= ptr
                       && p1 + 12 >= ptr
-                      && memcmp (p1, "SELECTOR-", 9) == 0)
+                      && memeq (p1, "SELECTOR-", 9))
                     {
                       const char *p2 = p1 + 9;
 
index 4f867d694af54ce418bb2ad6cb6cc8638e2eaa6b..1351fd7ec33931cb7316de072c983bdba573ccad 100644 (file)
@@ -452,7 +452,7 @@ relativize (const char *filename,
           break;
       /* Did the components match?  */
       if (!(filename_s - filename == dir2_s - dir2
-            && memcmp (filename, dir2, dir2_s - dir2) == 0))
+            && memeq (filename, dir2, dir2_s - dir2)))
         break;
       dir2 = dir2_s;
       filename = filename_s;
index 9e7229a8f004adc316972e3ce3530ee52680021e..1b9bc9abf502c542c0422496fbe908896decc2fb 100644 (file)
@@ -18,6 +18,7 @@ quote
 quotearg
 bool
 stdlib-h
+stringeq
 
 configure.ac:
 
index 0090e227825e8db05deefad396742355879d1e97..d4555a126acc226082f0a79602b8dba0eb5c68f6 100644 (file)
@@ -24,6 +24,7 @@ renameatu
 bool
 stdckdint-h
 stdint-h
+stringeq
 xalloc-die
 
 configure.ac:
index fbd71330adb3b3bd549beae38c33af4c7082d966..db9d3d60a76eeeab3b6afdafb048010f04a7c6a5 100644 (file)
@@ -8,6 +8,7 @@ lib/bcp47.c
 Depends-on:
 bool
 c-ctype
+stringeq
 
 configure.ac:
 
index bd05d916f9ed7f9a4d552c2522533f800fadc645..e9c06941f8d053a077b37c03d715c57221a19170 100644 (file)
@@ -11,6 +11,7 @@ m4/readutmp.m4
 Depends-on:
 extensions
 idx
+stringeq
 stat-time
 gettimeofday
 bool
index acb9a26b233e1fd3a387cedf47389a94e43095e6..0e9c226fae95f86a08ae49284621d3bee5cb81fa 100644 (file)
@@ -18,6 +18,7 @@ scandir
 alphasort
 sh-quote
 safe-read
+stringeq
 xmalloca
 xvasprintf
 gettext-h
index 3a9d323ce0bc86600be6a4e1fc9a30396e5cd77b..b1ac3f37b39ee570164cb4a564ef01819658456c 100644 (file)
@@ -22,6 +22,7 @@ xsetenv
 scandir
 alphasort
 sh-quote
+stringeq
 xalloc
 xmalloca
 copy-file
index aefd7862471c2c826fc857d5989fd8c6cf52eac1..a128e64483381b254ab2ad11ba1253d67cf50d14 100644 (file)
@@ -18,6 +18,7 @@ minmax
 free-posix
 limits-h
 stdint-h
+stringeq
 malloc-posix
 ssize_t
 stat
index 361a375f2b9f756d7c3df0e3afedc3a697c35af1..d0fa5210c5ef8023e7bbde7dd76d415792ee8e73 100644 (file)
@@ -7,6 +7,7 @@ lib/get_ppid_of.c
 
 Depends-on:
 extensions
+stringeq
 sys_types-h
 unistd-h
 open
index 252f86ac9a30f4d960b52e5ec795ee7449408fd0..ce1f29de9d613e8aa2ea9f03af5754fdbb607096 100644 (file)
@@ -7,6 +7,7 @@ lib/get_progname_of.c
 
 Depends-on:
 extensions
+stringeq
 unistd-h
 open
 
index de85572dc9d8332711bc25542c9c97001cba77f1..cf5f326a7ffe55e988e2007af552eff4bb7422e3 100644 (file)
@@ -11,6 +11,7 @@ unistd-h
 extensions
 malloca         [test $HAVE_GETLOGIN_R = 0 || test $REPLACE_GETLOGIN_R = 1]
 memchr          [test $HAVE_GETLOGIN_R = 0 || test $REPLACE_GETLOGIN_R = 1]
+stringeq        [test $HAVE_GETLOGIN_R = 0 || test $REPLACE_GETLOGIN_R = 1]
 
 configure.ac:
 gl_FUNC_GETLOGIN_R
index 1f79d57e1d6ecb21b5af2a20ab3a677d15126984..9be00baa91da996bb3ae1f0ec271700e2476cb09 100644 (file)
@@ -11,6 +11,7 @@ stdlib-h
 basename-lgpl   [test $HAVE_GETPROGNAME = 0]
 extensions      [test $HAVE_GETPROGNAME = 0]
 open            [test $HAVE_GETPROGNAME = 0 && case "$host_os" in sco* | unixware*) true;; *) false;; esac]
+stringeq        [test $HAVE_GETPROGNAME = 0]
 
 configure.ac:
 AC_REQUIRE([AC_CANONICAL_HOST])
index 9f67320f85a12434d3ff6e7507b77f745cb697a9..46921d75f98e99ae3e1bd3fe7e4c998b7d3ad8ee 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 sys_stat-h
 extensions
 c99             [test $HAVE_GETUMASK = 0]
+stringeq        [test $HAVE_GETUMASK = 0]
 unistd-h        [test $HAVE_GETUMASK = 0]
 clean-temp      [test $HAVE_GETUMASK = 0]
 tempname        [test $HAVE_GETUMASK = 0]
index d5dea9e6089072280d6114bdb68096cbba555bec..ba96eb7c6f2c2e6dcf9392555c1f96849d1d6d9f 100644 (file)
@@ -9,6 +9,7 @@ isnanf
 isnand
 isnanl
 math-h
+stringeq
 extensions
 
 configure.ac:
index b9863f6a0e2226dbed29f957d6638282e4073ce1..272dd51b267812b323516cd02bd166c58f626168 100644 (file)
@@ -26,6 +26,7 @@ c32isxdigit
 c32tolower
 c32width
 memcmp
+stringeq
 
 configure.ac:
 gl_MBCHAR
index 43f9df0059632ba1a56de1b498038a66db0cb739..63ad4d641d5cb0a8559adc5979df4cc5c5366617 100644 (file)
@@ -8,6 +8,7 @@ lib/mem-hash-map.c
 Depends-on:
 next-prime
 obstack
+stringeq
 xalloc
 
 configure.ac:
index 886e8187ae07b444286d65dbb01327ee54ad8c23..91fdce03263b32f06df90c53df8d2fe30990e78e 100644 (file)
@@ -8,6 +8,7 @@ m4/memcoll.m4
 
 Depends-on:
 memcmp
+stringeq
 
 configure.ac:
 gl_MEMCOLL
index fc244e2b8622460097fd9e08e85556712b4856ac..10909f3a4ab73b3625d6e466d1f6ca5c0d2923d3 100644 (file)
@@ -7,6 +7,7 @@ lib/progname.c
 
 Depends-on:
 snippet/arg-nonnull
+stringeq
 
 configure.ac:
 AC_CHECK_DECLS([program_invocation_name], [], [], [#include <errno.h>])
index 5919f40ce32f0b4ffd5fe4dd93d0af6b33465bbb..87fc962ebce50d4c7a206486a6ffcb3f39b9f810 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 signal-h
 threadlib
 sigprocmask     [test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1]
+stringeq        [test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1]
 
 configure.ac:
 gl_FUNC_PTHREAD_SIGMASK
index 0ac616bd97f73862cae69637c9d71786e590879a..fc2006a3a2f0e03e8b41412626129497cf534923 100644 (file)
@@ -22,6 +22,7 @@ minmax
 quotearg-simple
 bool
 stdint-h
+stringeq
 uchar-h
 xalloc
 
index 54470acecef8b666842c6b096460c629d83a694d..b4199ac6150bdc33fd40dc6e1614bb4c0c55ece6 100644 (file)
@@ -15,6 +15,7 @@ stat-time
 gettimeofday
 bool
 stdint-h
+stringeq
 strnlen
 time-h
 unlocked-io-internal
index 475eb1d8b0ba2133638a84f478adf63256a1f538..844a2da634382258383dcf845846d80a3ae8c4a9 100644 (file)
@@ -19,6 +19,7 @@ Depends-on:
 relocatable-prog-wrapper
 progname
 canonicalize-lgpl
+stringeq
 xalloc
 xreadlink
 open
index 95620104fef34c904038eb6997782c72048eeccb..1f42013e96d4e39e4ab68f9334af3e4e4a6ea47d 100644 (file)
@@ -75,6 +75,7 @@ stdckdint-h
 stdint-h
 stdlib-h
 string-h
+stringeq
 sys_stat-h
 unistd-h
 xalloc-oversized
index 2cf9b8bfe73ad9875de4de582ac30b05367e1f1d..2bd68f8bb0101581a7e0e86253a34480aaad2d45 100644 (file)
@@ -15,6 +15,7 @@ fstat
 fstatat
 openat
 same-inode
+stringeq
 bool
 memcmp
 
index 34649b7ec372c180616dd62a4170b12e6fc2205a..7051c141b62540eed971aee69c733a299ca5f404 100644 (file)
@@ -16,6 +16,7 @@ isnand-nolibm   [test $REPLACE_SIGNBIT = 1]
 isnanl-nolibm   [test $REPLACE_SIGNBIT = 1]
 fpieee          [test $REPLACE_SIGNBIT = 1]
 memcmp          [test $REPLACE_SIGNBIT = 1]
+stringeq        [test $REPLACE_SIGNBIT = 1]
 
 configure.ac:
 gl_SIGNBIT
index cc4e38cf4b3d00bfd4ee7e23eef6fffba4705e14..b608ee062169d62b2ae36ab3a249dfd965c7d7a4 100644 (file)
@@ -16,6 +16,7 @@ memchr
 memrchr
 memmem
 full-write
+stringeq
 
 configure.ac:
 
index 5813e92ada2a6c5ac0184db2095221b64c129119..692fda3923387e8935c896119e9ef65f0c3816d4 100644 (file)
@@ -10,6 +10,7 @@ Depends-on:
 uniname/base
 attribute
 memcmp
+stringeq
 bool
 c99
 
index ccdf2b5b1b06e3435e3ff678688d2750e44f5d17..44f56a4a2c17c4cfae442877b51add969afa5c65 100644 (file)
@@ -9,6 +9,7 @@ Depends-on:
 time-h
 bool
 spawn-pipe
+stringeq
 wait-process
 execute
 safe-read