From: Paul Eggert Date: Wed, 17 Sep 2025 01:57:41 +0000 (-0700) Subject: stringeq: prefer memeq to memcmp in other modules X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ca831b019e8660b0f863d7ad487b9c4b08ef7df;p=thirdparty%2Fgnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index a098c20208..e99039ed81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,34 @@ 2025-09-17 Paul Eggert + 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. diff --git a/lib/argmatch.c b/lib/argmatch.c index e9b7c66a72..4dcea99ccb 100644 --- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -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; } diff --git a/lib/argmatch.h b/lib/argmatch.h index 4eac4ac938..c242ebca9e 100644 --- a/lib/argmatch.h +++ b/lib/argmatch.h @@ -30,7 +30,7 @@ # include # include # include -# include /* memcmp */ +# include /* 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)) \ diff --git a/lib/backupfile.c b/lib/backupfile.c index 585268e0cb..cfbc901efe 100644 --- a/lib/backupfile.c +++ b/lib/backupfile.c @@ -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; diff --git a/lib/bcp47.c b/lib/bcp47.c index 46fd31b5d4..33a078c8a2 100644 --- a/lib/bcp47.c +++ b/lib/bcp47.c @@ -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. */ diff --git a/lib/boot-time.c b/lib/boot-time.c index 82c2a26f6b..65d7aeaa4a 100644 --- a/lib/boot-time.c +++ b/lib/boot-time.c @@ -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 } diff --git a/lib/csharpcomp.c b/lib/csharpcomp.c index bda064b686..50f8c80403 100644 --- a/lib/csharpcomp.c +++ b/lib/csharpcomp.c @@ -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. */ diff --git a/lib/csharpexec.c b/lib/csharpexec.c index 3852424229..8e3f7983f0 100644 --- a/lib/csharpexec.c +++ b/lib/csharpexec.c @@ -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, ' '); diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c index 0dc42a91b2..d2fa69a283 100644 --- a/lib/file-has-acl.c +++ b/lib/file-has-acl.c @@ -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; diff --git a/lib/gen-uni-tables.c b/lib/gen-uni-tables.c index e48094d0f7..4dbe7f5f13 100644 --- a/lib/gen-uni-tables.c +++ b/lib/gen-uni-tables.c @@ -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 ("", 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 { diff --git a/lib/get_ppid_of.c b/lib/get_ppid_of.c index ad940937b7..83df0065e6 100644 --- a/lib/get_ppid_of.c +++ b/lib/get_ppid_of.c @@ -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) diff --git a/lib/get_progname_of.c b/lib/get_progname_of.c index c8b9b87798..0cc180e15d 100644 --- a/lib/get_progname_of.c +++ b/lib/get_progname_of.c @@ -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 diff --git a/lib/getlogin_r.c b/lib/getlogin_r.c index ade819940e..eb31008ea1 100644 --- a/lib/getlogin_r.c +++ b/lib/getlogin_r.c @@ -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); diff --git a/lib/getprogname.c b/lib/getprogname.c index bf818b8b5c..4da2159fe3 100644 --- a/lib/getprogname.c +++ b/lib/getprogname.c @@ -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 diff --git a/lib/getumask.c b/lib/getumask.c index b2a2afff21..f5daffb3ae 100644 --- a/lib/getumask.c +++ b/lib/getumask.c @@ -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; diff --git a/lib/isnan.c b/lib/isnan.c index c8a65caaa5..915187bafa 100644 --- a/lib/isnan.c +++ b/lib/isnan.c @@ -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; diff --git a/lib/mbchar.h b/lib/mbchar.h index 85422cd527..ba142425d4 100644 --- a/lib/mbchar.h +++ b/lib/mbchar.h @@ -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)) /* , classification. */ #define mb_isascii(mbc) \ diff --git a/lib/mem-hash-map.c b/lib/mem-hash-map.c index 1cd4f436cc..23fc80fa89 100644 --- a/lib/mem-hash-map.c +++ b/lib/mem-hash-map.c @@ -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); diff --git a/lib/memcoll.c b/lib/memcoll.c index 591c3a836d..e74358a454 100644 --- a/lib/memcoll.c +++ b/lib/memcoll.c @@ -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; diff --git a/lib/progname.c b/lib/progname.c index 4b0c9cc6ac..adcde62ef3 100644 --- a/lib/progname.c +++ b/lib/progname.c @@ -43,7 +43,7 @@ set_program_name (const char *argv0) Remove this "/.libs/" or "/.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) diff --git a/lib/progreloc.c b/lib/progreloc.c index 17848589e8..715e750e7a 100644 --- a/lib/progreloc.c +++ b/lib/progreloc.c @@ -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 ("")) { diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c index 1121624616..0d0a5c211d 100644 --- a/lib/pthread_sigmask.c +++ b/lib/pthread_sigmask.c @@ -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 diff --git a/lib/quotearg.c b/lib/quotearg.c index 325f3d9172..ded23c710f 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -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; diff --git a/lib/readutmp.c b/lib/readutmp.c index e4ac917060..1ddc4a5117 100644 --- a/lib/readutmp.c +++ b/lib/readutmp.c @@ -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 } diff --git a/lib/same.c b/lib/same.c index 223a847938..da6147cf3a 100644 --- a/lib/same.c +++ b/lib/same.c @@ -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); diff --git a/lib/signbitd.c b/lib/signbitd.c index 569d7a69e4..6cbfa10742 100644 --- a/lib/signbitd.c +++ b/lib/signbitd.c @@ -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; diff --git a/lib/signbitf.c b/lib/signbitf.c index c99dee7594..d833b4b902 100644 --- a/lib/signbitf.c +++ b/lib/signbitf.c @@ -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; diff --git a/lib/signbitl.c b/lib/signbitl.c index c925bc0cc6..0b1854217c 100644 --- a/lib/signbitl.c +++ b/lib/signbitl.c @@ -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; diff --git a/lib/string-desc.c b/lib/string-desc.c index eb91d035cb..0ff0c4db6a 100644 --- a/lib/string-desc.c +++ b/lib/string-desc.c @@ -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 diff --git a/lib/unictype/3level.h b/lib/unictype/3level.h index a9752effbd..be8b9cf52a 100644 --- a/lib/unictype/3level.h +++ b/lib/unictype/3level.h @@ -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; diff --git a/lib/unictype/3levelbit.h b/lib/unictype/3levelbit.h index fb63998193..981efa9699 100644 --- a/lib/unictype/3levelbit.h +++ b/lib/unictype/3levelbit.h @@ -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; diff --git a/lib/uniname/uniname.c b/lib/uniname/uniname.c index ad9407edd2..953b70df06 100644 --- a/lib/uniname/uniname.c +++ b/lib/uniname/uniname.c @@ -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; diff --git a/lib/vc-mtime.c b/lib/vc-mtime.c index 4f867d694a..1351fd7ec3 100644 --- a/lib/vc-mtime.c +++ b/lib/vc-mtime.c @@ -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; diff --git a/modules/argmatch b/modules/argmatch index 9e7229a8f0..1b9bc9abf5 100644 --- a/modules/argmatch +++ b/modules/argmatch @@ -18,6 +18,7 @@ quote quotearg bool stdlib-h +stringeq configure.ac: diff --git a/modules/backupfile b/modules/backupfile index 0090e22782..d4555a126a 100644 --- a/modules/backupfile +++ b/modules/backupfile @@ -24,6 +24,7 @@ renameatu bool stdckdint-h stdint-h +stringeq xalloc-die configure.ac: diff --git a/modules/bcp47 b/modules/bcp47 index fbd71330ad..db9d3d60a7 100644 --- a/modules/bcp47 +++ b/modules/bcp47 @@ -8,6 +8,7 @@ lib/bcp47.c Depends-on: bool c-ctype +stringeq configure.ac: diff --git a/modules/boot-time b/modules/boot-time index bd05d916f9..e9c06941f8 100644 --- a/modules/boot-time +++ b/modules/boot-time @@ -11,6 +11,7 @@ m4/readutmp.m4 Depends-on: extensions idx +stringeq stat-time gettimeofday bool diff --git a/modules/csharpcomp b/modules/csharpcomp index acb9a26b23..0e9c226fae 100644 --- a/modules/csharpcomp +++ b/modules/csharpcomp @@ -18,6 +18,7 @@ scandir alphasort sh-quote safe-read +stringeq xmalloca xvasprintf gettext-h diff --git a/modules/csharpexec b/modules/csharpexec index 3a9d323ce0..b1ac3f37b3 100644 --- a/modules/csharpexec +++ b/modules/csharpexec @@ -22,6 +22,7 @@ xsetenv scandir alphasort sh-quote +stringeq xalloc xmalloca copy-file diff --git a/modules/file-has-acl b/modules/file-has-acl index aefd786247..a128e64483 100644 --- a/modules/file-has-acl +++ b/modules/file-has-acl @@ -18,6 +18,7 @@ minmax free-posix limits-h stdint-h +stringeq malloc-posix ssize_t stat diff --git a/modules/get_ppid_of b/modules/get_ppid_of index 361a375f2b..d0fa5210c5 100644 --- a/modules/get_ppid_of +++ b/modules/get_ppid_of @@ -7,6 +7,7 @@ lib/get_ppid_of.c Depends-on: extensions +stringeq sys_types-h unistd-h open diff --git a/modules/get_progname_of b/modules/get_progname_of index 252f86ac9a..ce1f29de9d 100644 --- a/modules/get_progname_of +++ b/modules/get_progname_of @@ -7,6 +7,7 @@ lib/get_progname_of.c Depends-on: extensions +stringeq unistd-h open diff --git a/modules/getlogin_r b/modules/getlogin_r index de85572dc9..cf5f326a7f 100644 --- a/modules/getlogin_r +++ b/modules/getlogin_r @@ -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 diff --git a/modules/getprogname b/modules/getprogname index 1f79d57e1d..9be00baa91 100644 --- a/modules/getprogname +++ b/modules/getprogname @@ -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]) diff --git a/modules/getumask b/modules/getumask index 9f67320f85..46921d75f9 100644 --- a/modules/getumask +++ b/modules/getumask @@ -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] diff --git a/modules/isnan b/modules/isnan index d5dea9e608..ba96eb7c6f 100644 --- a/modules/isnan +++ b/modules/isnan @@ -9,6 +9,7 @@ isnanf isnand isnanl math-h +stringeq extensions configure.ac: diff --git a/modules/mbchar b/modules/mbchar index b9863f6a0e..272dd51b26 100644 --- a/modules/mbchar +++ b/modules/mbchar @@ -26,6 +26,7 @@ c32isxdigit c32tolower c32width memcmp +stringeq configure.ac: gl_MBCHAR diff --git a/modules/mem-hash-map b/modules/mem-hash-map index 43f9df0059..63ad4d641d 100644 --- a/modules/mem-hash-map +++ b/modules/mem-hash-map @@ -8,6 +8,7 @@ lib/mem-hash-map.c Depends-on: next-prime obstack +stringeq xalloc configure.ac: diff --git a/modules/memcoll b/modules/memcoll index 886e8187ae..91fdce0326 100644 --- a/modules/memcoll +++ b/modules/memcoll @@ -8,6 +8,7 @@ m4/memcoll.m4 Depends-on: memcmp +stringeq configure.ac: gl_MEMCOLL diff --git a/modules/progname b/modules/progname index fc244e2b86..10909f3a4a 100644 --- a/modules/progname +++ b/modules/progname @@ -7,6 +7,7 @@ lib/progname.c Depends-on: snippet/arg-nonnull +stringeq configure.ac: AC_CHECK_DECLS([program_invocation_name], [], [], [#include ]) diff --git a/modules/pthread_sigmask b/modules/pthread_sigmask index 5919f40ce3..87fc962ebc 100644 --- a/modules/pthread_sigmask +++ b/modules/pthread_sigmask @@ -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 diff --git a/modules/quotearg b/modules/quotearg index 0ac616bd97..fc2006a3a2 100644 --- a/modules/quotearg +++ b/modules/quotearg @@ -22,6 +22,7 @@ minmax quotearg-simple bool stdint-h +stringeq uchar-h xalloc diff --git a/modules/readutmp b/modules/readutmp index 54470acece..b4199ac615 100644 --- a/modules/readutmp +++ b/modules/readutmp @@ -15,6 +15,7 @@ stat-time gettimeofday bool stdint-h +stringeq strnlen time-h unlocked-io-internal diff --git a/modules/relocatable-prog b/modules/relocatable-prog index 475eb1d8b0..844a2da634 100644 --- a/modules/relocatable-prog +++ b/modules/relocatable-prog @@ -19,6 +19,7 @@ Depends-on: relocatable-prog-wrapper progname canonicalize-lgpl +stringeq xalloc xreadlink open diff --git a/modules/relocatable-prog-wrapper b/modules/relocatable-prog-wrapper index 95620104fe..1f42013e96 100644 --- a/modules/relocatable-prog-wrapper +++ b/modules/relocatable-prog-wrapper @@ -75,6 +75,7 @@ stdckdint-h stdint-h stdlib-h string-h +stringeq sys_stat-h unistd-h xalloc-oversized diff --git a/modules/same b/modules/same index 2cf9b8bfe7..2bd68f8bb0 100644 --- a/modules/same +++ b/modules/same @@ -15,6 +15,7 @@ fstat fstatat openat same-inode +stringeq bool memcmp diff --git a/modules/signbit b/modules/signbit index 34649b7ec3..7051c141b6 100644 --- a/modules/signbit +++ b/modules/signbit @@ -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 diff --git a/modules/string-desc b/modules/string-desc index cc4e38cf4b..b608ee0621 100644 --- a/modules/string-desc +++ b/modules/string-desc @@ -16,6 +16,7 @@ memchr memrchr memmem full-write +stringeq configure.ac: diff --git a/modules/uniname/uniname b/modules/uniname/uniname index 5813e92ada..692fda3923 100644 --- a/modules/uniname/uniname +++ b/modules/uniname/uniname @@ -10,6 +10,7 @@ Depends-on: uniname/base attribute memcmp +stringeq bool c99 diff --git a/modules/vc-mtime b/modules/vc-mtime index ccdf2b5b1b..44f56a4a2c 100644 --- a/modules/vc-mtime +++ b/modules/vc-mtime @@ -9,6 +9,7 @@ Depends-on: time-h bool spawn-pipe +stringeq wait-process execute safe-read