mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-05-13 15:13:36 +00:00
stringeq: prefer streq to strcmp in other modules
* lib/acl-internal.c, lib/argmatch.c, lib/argp-help.c: * lib/argp-parse.c, lib/bcp47.c, lib/c32_get_mapping.c: * lib/c32_get_type_test.c, lib/concat-filename.c: * lib/cpu-supports.h, lib/dfa.c, lib/duplocale.c, lib/exclude.c: * lib/findprog-in.c, lib/findprog.c, lib/fopen.c, lib/freopen.c: * lib/fts.c, lib/gen-uni-tables.c, lib/getfilecon.c: * lib/getlogin.c, lib/getugroups.c, lib/hard-locale.c: * lib/hashcode-named-file.c, lib/hashkey-string.c: * lib/iconv_open.c, lib/idcache.c, lib/lc-charset-unicode.c: * lib/localcharset.c, lib/localename-environ.c: * lib/localename-unsafe.c, lib/mbs_endswith.c, lib/mountlist.c: * lib/newlocale.c, lib/nl_langinfo.c, lib/nproc.c, lib/open.c: * lib/os2-spawn.c, lib/parse-datetime.y, lib/popen.c: * lib/progreloc.c, lib/propername.c, lib/pt_chown.c, lib/putenv.c: * lib/qcopy-acl.c, lib/readutmp.c, lib/rpmatch.c: * lib/setlocale-fixes.c, lib/setlocale.c, lib/sig2str.c: * lib/spawni.c, lib/stat.c, lib/str_endswith.c, lib/streq.h: * lib/striconveha.c, lib/struniq.h, lib/supersede.c: * lib/time_rz.c, lib/unicodeio.c, lib/vasnprintf.c: * lib/vc-mtime.c, lib/wctrans-impl.h, lib/wctype-impl.h: Prefer streq to strcmp 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 (streq): New static function, in same style. * modules/acl-permissions, modules/argp, modules/c32_get_mapping: * modules/c32_get_type_test, modules/concat-filename: * modules/cpu-supports, modules/dfa, modules/duplocale: * modules/exclude, modules/findprog, modules/findprog-in: * modules/fopen, modules/fopen-gnu, modules/freopen, modules/fts: * modules/getlocalename_l-simple, modules/getlocalename_l-unsafe: * modules/getlogin, modules/getugroups, modules/hard-locale: * modules/hashcode-named-file, modules/hashkey-string: * modules/iconv_open, modules/idcache, modules/localcharset: * modules/localename, modules/localename-unsafe: * modules/mbs_endswith, modules/mountlist, modules/newlocale: * modules/nl_langinfo, modules/nproc, modules/open: * modules/parse-datetime, modules/popen: * modules/posix_spawn-internal, modules/propername: * modules/pt_chown, modules/putenv-gnu, modules/qcopy-acl: * modules/rpmatch, modules/selinux-h, modules/setenv: * modules/setlocale, modules/setlocale-fixes, modules/sig2str: * modules/spawn-pipe, modules/stat, modules/str_endswith: * modules/streq, modules/striconveha, modules/supersede: * modules/time_rz, modules/uchar-h, modules/unicodeio: * modules/uniconv/base, modules/wctrans, modules/wctype: (Depends-on): Add stringeq.
This commit is contained in:
48
ChangeLog
48
ChangeLog
@@ -1,5 +1,53 @@
|
||||
2025-09-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
stringeq: prefer streq to strcmp in other modules
|
||||
* lib/acl-internal.c, lib/argmatch.c, lib/argp-help.c:
|
||||
* lib/argp-parse.c, lib/bcp47.c, lib/c32_get_mapping.c:
|
||||
* lib/c32_get_type_test.c, lib/concat-filename.c:
|
||||
* lib/cpu-supports.h, lib/dfa.c, lib/duplocale.c, lib/exclude.c:
|
||||
* lib/findprog-in.c, lib/findprog.c, lib/fopen.c, lib/freopen.c:
|
||||
* lib/fts.c, lib/gen-uni-tables.c, lib/getfilecon.c:
|
||||
* lib/getlogin.c, lib/getugroups.c, lib/hard-locale.c:
|
||||
* lib/hashcode-named-file.c, lib/hashkey-string.c:
|
||||
* lib/iconv_open.c, lib/idcache.c, lib/lc-charset-unicode.c:
|
||||
* lib/localcharset.c, lib/localename-environ.c:
|
||||
* lib/localename-unsafe.c, lib/mbs_endswith.c, lib/mountlist.c:
|
||||
* lib/newlocale.c, lib/nl_langinfo.c, lib/nproc.c, lib/open.c:
|
||||
* lib/os2-spawn.c, lib/parse-datetime.y, lib/popen.c:
|
||||
* lib/progreloc.c, lib/propername.c, lib/pt_chown.c, lib/putenv.c:
|
||||
* lib/qcopy-acl.c, lib/readutmp.c, lib/rpmatch.c:
|
||||
* lib/setlocale-fixes.c, lib/setlocale.c, lib/sig2str.c:
|
||||
* lib/spawni.c, lib/stat.c, lib/str_endswith.c, lib/streq.h:
|
||||
* lib/striconveha.c, lib/struniq.h, lib/supersede.c:
|
||||
* lib/time_rz.c, lib/unicodeio.c, lib/vasnprintf.c:
|
||||
* lib/vc-mtime.c, lib/wctrans-impl.h, lib/wctype-impl.h:
|
||||
Prefer streq to strcmp 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 (streq): New static function, in same style.
|
||||
* modules/acl-permissions, modules/argp, modules/c32_get_mapping:
|
||||
* modules/c32_get_type_test, modules/concat-filename:
|
||||
* modules/cpu-supports, modules/dfa, modules/duplocale:
|
||||
* modules/exclude, modules/findprog, modules/findprog-in:
|
||||
* modules/fopen, modules/fopen-gnu, modules/freopen, modules/fts:
|
||||
* modules/getlocalename_l-simple, modules/getlocalename_l-unsafe:
|
||||
* modules/getlogin, modules/getugroups, modules/hard-locale:
|
||||
* modules/hashcode-named-file, modules/hashkey-string:
|
||||
* modules/iconv_open, modules/idcache, modules/localcharset:
|
||||
* modules/localename, modules/localename-unsafe:
|
||||
* modules/mbs_endswith, modules/mountlist, modules/newlocale:
|
||||
* modules/nl_langinfo, modules/nproc, modules/open:
|
||||
* modules/parse-datetime, modules/popen:
|
||||
* modules/posix_spawn-internal, modules/propername:
|
||||
* modules/pt_chown, modules/putenv-gnu, modules/qcopy-acl:
|
||||
* modules/rpmatch, modules/selinux-h, modules/setenv:
|
||||
* modules/setlocale, modules/setlocale-fixes, modules/sig2str:
|
||||
* modules/spawn-pipe, modules/stat, modules/str_endswith:
|
||||
* modules/streq, modules/striconveha, modules/supersede:
|
||||
* modules/time_rz, modules/uchar-h, modules/unicodeio:
|
||||
* modules/uniconv/base, modules/wctrans, modules/wctype:
|
||||
(Depends-on): Add stringeq.
|
||||
|
||||
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:
|
||||
|
||||
@@ -118,9 +118,9 @@ acl_access_nontrivial (acl_t acl)
|
||||
- S-1-5-32-545 (group "Users")
|
||||
Cf. <https://learn.microsoft.com/en-us/windows/win32/secauthz/well-known-sids>
|
||||
and look at the output of the 'mkgroup' command. */
|
||||
ignorable = (strcmp (group_sid, "S-1-5-18") == 0
|
||||
|| strcmp (group_sid, "S-1-5-32-544") == 0
|
||||
|| strcmp (group_sid, "S-1-5-32-545") == 0);
|
||||
ignorable = (streq (group_sid, "S-1-5-18")
|
||||
|| streq (group_sid, "S-1-5-32-544")
|
||||
|| streq (group_sid, "S-1-5-32-545"));
|
||||
}
|
||||
}
|
||||
if (!ignorable)
|
||||
|
||||
@@ -126,7 +126,7 @@ argmatch_exact (const char *arg, const char *const *arglist)
|
||||
/* Test elements for exact match. */
|
||||
for (i = 0; arglist[i]; i++)
|
||||
{
|
||||
if (!strcmp (arglist[i], arg))
|
||||
if (streq (arglist[i], arg))
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
@@ -654,7 +654,7 @@ hol_find_entry (struct hol *hol, const char *name)
|
||||
unsigned num_opts = entry->num;
|
||||
|
||||
while (num_opts-- > 0)
|
||||
if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0)
|
||||
if (opt->name && ovisible (opt) && streq (opt->name, name))
|
||||
return entry;
|
||||
else
|
||||
opt++;
|
||||
|
||||
@@ -177,7 +177,7 @@ find_long_option (struct option *long_options, const char *name)
|
||||
{
|
||||
struct option *l = long_options;
|
||||
while (l->name != NULL)
|
||||
if (name != NULL && strcmp (l->name, name) == 0)
|
||||
if (name != NULL && streq (l->name, name))
|
||||
return l - long_options;
|
||||
else
|
||||
l++;
|
||||
@@ -814,8 +814,7 @@ parser_parse_next (struct parser *parser, int *arg_ebadkey)
|
||||
{
|
||||
parser->try_getopt = 0;
|
||||
if (parser->state.next > 1
|
||||
&& strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
|
||||
== 0)
|
||||
&& streq (parser->state.argv[parser->state.next - 1], QUOTE))
|
||||
/* Not only is this the end of the options, but it's a
|
||||
"quoted" region, which may have args that *look* like
|
||||
options, so we definitely shouldn't try to use getopt past
|
||||
|
||||
12
lib/bcp47.c
12
lib/bcp47.c
@@ -192,14 +192,14 @@ void
|
||||
xpg_to_bcp47 (char *bcp47, const char *xpg)
|
||||
{
|
||||
/* Special cases. */
|
||||
if (strcmp (xpg, "") == 0)
|
||||
if (streq (xpg, ""))
|
||||
fail:
|
||||
{
|
||||
strcpy (bcp47, "und");
|
||||
return;
|
||||
}
|
||||
if ((xpg[0] == 'C' && (xpg[1] == '\0' || xpg[1] == '.'))
|
||||
|| strcmp (xpg, "POSIX") == 0)
|
||||
|| streq (xpg, "POSIX"))
|
||||
{
|
||||
/* The "C" (or "C.UTF-8") and "POSIX" locales most closely resemble the
|
||||
"en_US" locale. */
|
||||
@@ -367,7 +367,7 @@ void
|
||||
bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
|
||||
{
|
||||
/* Special cases. */
|
||||
if (strcmp (bcp47, "") == 0)
|
||||
if (streq (bcp47, ""))
|
||||
fail:
|
||||
{
|
||||
strcpy (xpg, "");
|
||||
@@ -514,7 +514,7 @@ bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
|
||||
default_script_in_territory (xpg, territory);
|
||||
if (sp != NULL)
|
||||
{
|
||||
if (strcmp (script, sp->name) == 0)
|
||||
if (streq (script, sp->name))
|
||||
script = NULL;
|
||||
}
|
||||
else if (memeq (xpg, "zh", 2))
|
||||
@@ -530,7 +530,7 @@ bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
|
||||
default_script_for_language2 (xpg);
|
||||
if (sp != NULL)
|
||||
{
|
||||
if (strcmp (script, sp->name) == 0)
|
||||
if (streq (script, sp->name))
|
||||
script = NULL;
|
||||
}
|
||||
else if (memeq (xpg, "iu", 2))
|
||||
@@ -545,7 +545,7 @@ bcp47_to_xpg (char *xpg, const char *bcp47, const char *codeset)
|
||||
default_script_for_language3 (xpg);
|
||||
if (sp != NULL)
|
||||
{
|
||||
if (strcmp (script, sp->name) == 0)
|
||||
if (streq (script, sp->name))
|
||||
script = NULL;
|
||||
}
|
||||
else if (memeq (xpg, "nan", 3))
|
||||
|
||||
@@ -39,11 +39,11 @@ c32_get_mapping (const char *name)
|
||||
switch (name[2])
|
||||
{
|
||||
case 'l':
|
||||
if (strcmp (name + 3, "ower") == 0)
|
||||
if (streq (name + 3, "ower"))
|
||||
return c32tolower;
|
||||
break;
|
||||
case 'u':
|
||||
if (strcmp (name + 3, "pper") == 0)
|
||||
if (streq (name + 3, "pper"))
|
||||
return c32toupper;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -43,11 +43,11 @@ c32_get_type_test (const char *name)
|
||||
switch (name[2])
|
||||
{
|
||||
case 'n':
|
||||
if (strcmp (name + 3, "um") == 0)
|
||||
if (streq (name + 3, "um"))
|
||||
return c32isalnum;
|
||||
break;
|
||||
case 'p':
|
||||
if (strcmp (name + 3, "ha") == 0)
|
||||
if (streq (name + 3, "ha"))
|
||||
return c32isalpha;
|
||||
break;
|
||||
default:
|
||||
@@ -59,34 +59,34 @@ c32_get_type_test (const char *name)
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (strcmp (name + 1, "lank") == 0)
|
||||
if (streq (name + 1, "lank"))
|
||||
return c32isblank;
|
||||
break;
|
||||
case 'c':
|
||||
if (strcmp (name + 1, "ntrl") == 0)
|
||||
if (streq (name + 1, "ntrl"))
|
||||
return c32iscntrl;
|
||||
break;
|
||||
case 'd':
|
||||
if (strcmp (name + 1, "igit") == 0)
|
||||
if (streq (name + 1, "igit"))
|
||||
return c32isdigit;
|
||||
break;
|
||||
case 'g':
|
||||
if (strcmp (name + 1, "raph") == 0)
|
||||
if (streq (name + 1, "raph"))
|
||||
return c32isgraph;
|
||||
break;
|
||||
case 'l':
|
||||
if (strcmp (name + 1, "ower") == 0)
|
||||
if (streq (name + 1, "ower"))
|
||||
return c32islower;
|
||||
break;
|
||||
case 'p':
|
||||
switch (name[1])
|
||||
{
|
||||
case 'r':
|
||||
if (strcmp (name + 2, "int") == 0)
|
||||
if (streq (name + 2, "int"))
|
||||
return c32isprint;
|
||||
break;
|
||||
case 'u':
|
||||
if (strcmp (name + 2, "nct") == 0)
|
||||
if (streq (name + 2, "nct"))
|
||||
return c32ispunct;
|
||||
break;
|
||||
default:
|
||||
@@ -94,15 +94,15 @@ c32_get_type_test (const char *name)
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (strcmp (name + 1, "pace") == 0)
|
||||
if (streq (name + 1, "pace"))
|
||||
return c32isspace;
|
||||
break;
|
||||
case 'u':
|
||||
if (strcmp (name + 1, "pper") == 0)
|
||||
if (streq (name + 1, "pper"))
|
||||
return c32isupper;
|
||||
break;
|
||||
case 'x':
|
||||
if (strcmp (name + 1, "digit") == 0)
|
||||
if (streq (name + 1, "digit"))
|
||||
return c32isxdigit;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -39,7 +39,7 @@ concatenated_filename (const char *directory, const char *filename,
|
||||
char *result;
|
||||
char *p;
|
||||
|
||||
if (strcmp (directory, ".") == 0)
|
||||
if (streq (directory, "."))
|
||||
{
|
||||
/* No need to prepend the directory. */
|
||||
result = (char *) malloc (strlen (filename)
|
||||
|
||||
@@ -50,10 +50,6 @@
|
||||
|
||||
|
||||
|
||||
# ifndef STREQ
|
||||
# define STREQ(a, b) (strcmp (a, b) == 0)
|
||||
# endif
|
||||
|
||||
/* Return the glibc.cpu.hwcaps setting (prepended with "-"),
|
||||
corresponding to the passed gcc _builtin_cpu_supports(FEATURE).
|
||||
Supported hwcaps can be identified from the bit_cpu_* defines
|
||||
@@ -68,14 +64,14 @@ gcc_feature_to_glibc_hwcap (char const *feature)
|
||||
if (0)
|
||||
;
|
||||
# if defined __x86_64__
|
||||
else if (STREQ (feature, "avx")) hwcap = "-AVX";
|
||||
else if (STREQ (feature, "avx2")) hwcap = "-AVX2";
|
||||
else if (STREQ (feature, "avx512bw")) hwcap = "-AVX512BW";
|
||||
else if (STREQ (feature, "avx512f")) hwcap = "-AVX512F";
|
||||
else if (STREQ (feature, "pclmul")) hwcap = "-PCLMULQDQ";
|
||||
else if (STREQ (feature, "vpclmulqdq")) hwcap = "-VPCLMULQDQ";
|
||||
else if (streq (feature, "avx")) hwcap = "-AVX";
|
||||
else if (streq (feature, "avx2")) hwcap = "-AVX2";
|
||||
else if (streq (feature, "avx512bw")) hwcap = "-AVX512BW";
|
||||
else if (streq (feature, "avx512f")) hwcap = "-AVX512F";
|
||||
else if (streq (feature, "pclmul")) hwcap = "-PCLMULQDQ";
|
||||
else if (streq (feature, "vpclmulqdq")) hwcap = "-VPCLMULQDQ";
|
||||
# elif defined __aarch64__
|
||||
else if (STREQ (feature, "pmull")) hwcap = "-PMULL";
|
||||
else if (streq (feature, "pmull")) hwcap = "-PMULL";
|
||||
# endif
|
||||
|
||||
return hwcap;
|
||||
|
||||
17
lib/dfa.c
17
lib/dfa.c
@@ -51,6 +51,7 @@
|
||||
# define c32isprint iswprint
|
||||
# define c32isspace iswspace
|
||||
# define mbszero(p) memset (p, 0, sizeof (mbstate_t))
|
||||
# define streq(a, b) (strcmp (a, b) == 0)
|
||||
#else
|
||||
/* Use ISO C 11 + gnulib API. */
|
||||
# include <uchar.h>
|
||||
@@ -63,12 +64,6 @@
|
||||
MMU will check anyway. */
|
||||
#define assume_nonnull(x) assume ((x) != NULL)
|
||||
|
||||
static bool
|
||||
str_eq (char const *a, char const *b)
|
||||
{
|
||||
return strcmp (a, b) == 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
c_isdigit (char c)
|
||||
{
|
||||
@@ -944,7 +939,7 @@ static const struct dfa_ctype *_GL_ATTRIBUTE_PURE
|
||||
find_pred (const char *str)
|
||||
{
|
||||
for (int i = 0; prednames[i].name; i++)
|
||||
if (str_eq (str, prednames[i].name))
|
||||
if (streq (str, prednames[i].name))
|
||||
return &prednames[i];
|
||||
return NULL;
|
||||
}
|
||||
@@ -1023,8 +1018,8 @@ parse_bracket_exp (struct dfa *dfa)
|
||||
worry about that possibility. */
|
||||
{
|
||||
char const *class
|
||||
= (dfa->syntax.case_fold && (str_eq (str, "upper")
|
||||
|| str_eq (str, "lower"))
|
||||
= (dfa->syntax.case_fold && (streq (str, "upper")
|
||||
|| streq (str, "lower"))
|
||||
? "alpha" : str);
|
||||
const struct dfa_ctype *pred = find_pred (class);
|
||||
if (!pred)
|
||||
@@ -4207,7 +4202,7 @@ dfamust (struct dfa const *d)
|
||||
idx_t j, ln, rn, n;
|
||||
|
||||
/* Guaranteed to be. Unlikely, but ... */
|
||||
if (str_eq (lmp->is, rmp->is))
|
||||
if (streq (lmp->is, rmp->is))
|
||||
{
|
||||
lmp->begline &= rmp->begline;
|
||||
lmp->endline &= rmp->endline;
|
||||
@@ -4254,7 +4249,7 @@ dfamust (struct dfa const *d)
|
||||
for (idx_t i = 0; mp->in[i] != NULL; i++)
|
||||
if (strlen (mp->in[i]) > strlen (result))
|
||||
result = mp->in[i];
|
||||
if (str_eq (result, mp->is))
|
||||
if (streq (result, mp->is))
|
||||
{
|
||||
if ((!need_begline || mp->begline) && (!need_endline
|
||||
|| mp->endline))
|
||||
|
||||
@@ -95,7 +95,7 @@ duplocale (locale_t locale)
|
||||
errno = err;
|
||||
return NULL;
|
||||
}
|
||||
if (strcmp (name, base_name) != 0)
|
||||
if (!streq (name, base_name))
|
||||
{
|
||||
locale_t copy = newlocale (category_mask, name, base_copy);
|
||||
if (copy == NULL)
|
||||
|
||||
@@ -240,7 +240,7 @@ string_hasher_ci (void const *data, size_t n_buckets)
|
||||
static bool
|
||||
string_compare (void const *data1, void const *data2)
|
||||
{
|
||||
return strcmp (data1, data2) == 0;
|
||||
return streq (data1, data2);
|
||||
}
|
||||
|
||||
/* compare two strings for equality, case-insensitive */
|
||||
@@ -659,7 +659,7 @@ add_exclude_file (void (*add_func) (struct exclude *, char const *, int),
|
||||
struct exclude *ex, char const *file_name, int options,
|
||||
char line_end)
|
||||
{
|
||||
if (strcmp (file_name, "-") == 0)
|
||||
if (streq (file_name, "-"))
|
||||
return add_exclude_fp (call_addfn, ex, stdin, options, line_end, &add_func);
|
||||
|
||||
FILE *in = fopen (file_name, "re");
|
||||
|
||||
@@ -156,7 +156,7 @@ find_in_given_path (const char *progname, const char *path,
|
||||
if (! S_ISDIR (statbuf.st_mode))
|
||||
{
|
||||
/* Found! */
|
||||
if (strcmp (progpathname, progname) == 0)
|
||||
if (streq (progpathname, progname))
|
||||
{
|
||||
free (progpathname);
|
||||
return progname;
|
||||
@@ -308,7 +308,7 @@ find_in_given_path (const char *progname, const char *path,
|
||||
if (! S_ISDIR (statbuf.st_mode))
|
||||
{
|
||||
/* Found! */
|
||||
if (strcmp (progpathname, progname) == 0)
|
||||
if (streq (progpathname, progname))
|
||||
{
|
||||
free (progpathname);
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ find_in_path (const char *progname)
|
||||
&& ! S_ISDIR (statbuf.st_mode))
|
||||
{
|
||||
/* Found! */
|
||||
if (strcmp (progpathname, progname) == 0)
|
||||
if (streq (progpathname, progname))
|
||||
{
|
||||
free (progpathname);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ rpl_fopen (const char *filename, const char *mode)
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 && ! defined __CYGWIN__
|
||||
if (strcmp (filename, "/dev/null") == 0)
|
||||
if (streq (filename, "/dev/null"))
|
||||
filename = "NUL";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ rpl_freopen (const char *filename, const char *mode, FILE *stream)
|
||||
FILE *result;
|
||||
#if defined _WIN32 && ! defined __CYGWIN__
|
||||
char const *null_device = "NUL";
|
||||
if (filename && strcmp (filename, "/dev/null") == 0)
|
||||
if (filename && streq (filename, "/dev/null"))
|
||||
filename = null_device;
|
||||
#else
|
||||
char const *null_device = "/dev/null";
|
||||
|
||||
@@ -233,7 +233,6 @@ static int fts_safe_changedir (FTS *, FTSENT *, int, const char *)
|
||||
#endif
|
||||
|
||||
#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
|
||||
#define STREQ(a, b) (strcmp (a, b) == 0)
|
||||
|
||||
#define CLR(opt) (sp->fts_options &= ~(opt))
|
||||
#define ISSET(opt) ((sp->fts_options & (opt)) != 0)
|
||||
@@ -2048,7 +2047,7 @@ internal_function
|
||||
fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *dir)
|
||||
{
|
||||
int ret;
|
||||
bool is_dotdot = dir && STREQ (dir, "..");
|
||||
bool is_dotdot = dir && streq (dir, "..");
|
||||
int newfd;
|
||||
|
||||
/* This clause handles the unusual case in which FTS_NOCHDIR
|
||||
@@ -2094,7 +2093,7 @@ fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *dir)
|
||||
not "..", diropen's use of O_NOFOLLOW ensures we don't mistakenly
|
||||
follow a symlink, so we can avoid the expense of this fstat. */
|
||||
if (ISSET(FTS_LOGICAL) || ! HAVE_WORKING_O_NOFOLLOW
|
||||
|| (dir && STREQ (dir, "..")))
|
||||
|| (dir && streq (dir, "..")))
|
||||
{
|
||||
struct stat sb;
|
||||
if (fstat(newfd, &sb))
|
||||
|
||||
@@ -64,7 +64,7 @@ str_endswith (const char *string, const char *suffix)
|
||||
{
|
||||
size_t len = strlen (string);
|
||||
size_t n = strlen (suffix);
|
||||
return len >= n && strcmp (string + len - n, suffix) == 0;
|
||||
return len >= n && streq (string + len - n, suffix);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -73,6 +73,12 @@ memeq (void const *s1, void const *s2, size_t n)
|
||||
return !memcmp (s1, s2, n);
|
||||
}
|
||||
|
||||
static bool
|
||||
streq (char const *s1, char const *s2)
|
||||
{
|
||||
return !strcmp (s1, s2);
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
|
||||
/* Reading UnicodeData.txt. */
|
||||
@@ -122,7 +128,7 @@ fill_attribute (unsigned int i,
|
||||
fprintf (stderr, "index too large\n");
|
||||
exit (1);
|
||||
}
|
||||
if (strcmp (field2, "Cs") == 0)
|
||||
if (streq (field2, "Cs"))
|
||||
/* Surrogates are UTF-16 artifacts, not real characters. Ignore them. */
|
||||
return;
|
||||
uni = &unicode_attributes[i];
|
||||
@@ -799,9 +805,9 @@ output_predicate (const char *filename, bool (*predicate) (unsigned int), const
|
||||
fprintf (stream, "/* Copyright (C) 2000-2025 Free Software Foundation, Inc.\n");
|
||||
fprintf (stream, "\n");
|
||||
output_library_license (stream,
|
||||
strcmp (filename, "unictype/categ_M.h") == 0
|
||||
streq (filename, "unictype/categ_M.h")
|
||||
|| str_startswith (filename, "unictype/ctype_")
|
||||
|| strcmp (filename, "uniwidth/width2.h") == 0);
|
||||
|| streq (filename, "uniwidth/width2.h"));
|
||||
fprintf (stream, "\n");
|
||||
|
||||
t.p = 4; /* or: 5 */
|
||||
@@ -2946,7 +2952,7 @@ fill_properties (const char *proplist_filename)
|
||||
i2 = i1;
|
||||
}
|
||||
#define PROP(name,code) \
|
||||
if (strcmp (propname, name) == 0) propcode = code; else
|
||||
if (streq (propname, name)) propcode = code; else
|
||||
/* PropList.txt */
|
||||
PROP ("White_Space", PROP_WHITE_SPACE)
|
||||
PROP ("Bidi_Control", PROP_BIDI_CONTROL)
|
||||
@@ -3015,7 +3021,7 @@ fill_properties (const char *proplist_filename)
|
||||
PROP ("Extended_Pictographic", PROP_EXTENDED_PICTOGRAPHIC)
|
||||
#undef PROP
|
||||
/* An enum-valued property from DerivedCoreProperties.txt */
|
||||
if (strcmp (propname, "InCB;") == 0)
|
||||
if (streq (propname, "InCB;"))
|
||||
{
|
||||
char valuename[200+1];
|
||||
unsigned int valuecode;
|
||||
@@ -3026,13 +3032,13 @@ fill_properties (const char *proplist_filename)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (strcmp (valuename, "None") == 0)
|
||||
if (streq (valuename, "None"))
|
||||
valuecode = UC_INDIC_CONJUNCT_BREAK_NONE;
|
||||
else if (strcmp (valuename, "Consonant") == 0)
|
||||
else if (streq (valuename, "Consonant"))
|
||||
valuecode = UC_INDIC_CONJUNCT_BREAK_CONSONANT;
|
||||
else if (strcmp (valuename, "Linker") == 0)
|
||||
else if (streq (valuename, "Linker"))
|
||||
valuecode = UC_INDIC_CONJUNCT_BREAK_LINKER;
|
||||
else if (strcmp (valuename, "Extend") == 0)
|
||||
else if (streq (valuename, "Extend"))
|
||||
valuecode = UC_INDIC_CONJUNCT_BREAK_EXTEND;
|
||||
else
|
||||
{
|
||||
@@ -3741,7 +3747,7 @@ is_property_iso_control (unsigned int ch)
|
||||
{
|
||||
bool result1 =
|
||||
(unicode_attributes[ch].name != NULL
|
||||
&& strcmp (unicode_attributes[ch].name, "<control>") == 0);
|
||||
&& streq (unicode_attributes[ch].name, "<control>"));
|
||||
bool result2 =
|
||||
is_category_Cc (ch);
|
||||
|
||||
@@ -3871,7 +3877,7 @@ static bool
|
||||
is_property_combining (unsigned int ch)
|
||||
{
|
||||
return (unicode_attributes[ch].name != NULL
|
||||
&& (strcmp (unicode_attributes[ch].combining, "0") != 0
|
||||
&& (!streq (unicode_attributes[ch].combining, "0")
|
||||
|| is_category_Mc (ch)
|
||||
|| is_category_Me (ch)
|
||||
|| is_category_Mn (ch)));
|
||||
@@ -4497,7 +4503,7 @@ fill_arabicshaping (const char *arabicshaping_filename)
|
||||
}
|
||||
assert (i < 0x110000);
|
||||
|
||||
#define TRY(name) else if (strcmp (joining_type_name, #name + 16) == 0) joining_type = name;
|
||||
#define TRY(name) else if (streq (joining_type_name, #name + 16)) joining_type = name;
|
||||
if (false) {}
|
||||
TRY(UC_JOINING_TYPE_U)
|
||||
TRY(UC_JOINING_TYPE_T)
|
||||
@@ -4518,7 +4524,7 @@ fill_arabicshaping (const char *arabicshaping_filename)
|
||||
&& joining_group_name[strlen (joining_group_name) - 1] == ' ')
|
||||
joining_group_name[strlen (joining_group_name) - 1] = '\0';
|
||||
|
||||
#define TRY(value,name) else if (strcmp (joining_group_name, name) == 0) joining_group = value;
|
||||
#define TRY(value,name) else if (streq (joining_group_name, name)) joining_group = value;
|
||||
if (false) {}
|
||||
TRY(UC_JOINING_GROUP_NONE, "No_Joining_Group")
|
||||
TRY(UC_JOINING_GROUP_AIN, "AIN")
|
||||
@@ -5223,7 +5229,7 @@ fill_scripts (const char *scripts_filename)
|
||||
assert (i2 < 0x110000);
|
||||
|
||||
for (script = numscripts - 1; script >= 0; script--)
|
||||
if (strcmp (scripts[script], scriptname) == 0)
|
||||
if (streq (scripts[script], scriptname))
|
||||
break;
|
||||
if (script < 0)
|
||||
{
|
||||
@@ -6321,7 +6327,7 @@ static bool
|
||||
is_cntrl (unsigned int ch)
|
||||
{
|
||||
return (unicode_attributes[ch].name != NULL
|
||||
&& (strcmp (unicode_attributes[ch].name, "<control>") == 0
|
||||
&& (streq (unicode_attributes[ch].name, "<control>")
|
||||
/* Categories Zl and Zp */
|
||||
|| (unicode_attributes[ch].category[0] == 'Z'
|
||||
&& (unicode_attributes[ch].category[1] == 'l'
|
||||
@@ -6354,7 +6360,7 @@ static bool
|
||||
is_graph (unsigned int ch)
|
||||
{
|
||||
return (unicode_attributes[ch].name != NULL
|
||||
&& strcmp (unicode_attributes[ch].name, "<control>")
|
||||
&& !streq (unicode_attributes[ch].name, "<control>")
|
||||
&& !is_space (ch));
|
||||
}
|
||||
|
||||
@@ -6362,7 +6368,7 @@ static bool
|
||||
is_print (unsigned int ch)
|
||||
{
|
||||
return (unicode_attributes[ch].name != NULL
|
||||
&& strcmp (unicode_attributes[ch].name, "<control>")
|
||||
&& !streq (unicode_attributes[ch].name, "<control>")
|
||||
/* Categories Zl and Zp */
|
||||
&& !(unicode_attributes[ch].name != NULL
|
||||
&& unicode_attributes[ch].category[0] == 'Z'
|
||||
@@ -7119,12 +7125,12 @@ symbolic_width (unsigned int ch)
|
||||
return '0';
|
||||
/* Test for double-width character. */
|
||||
if (unicode_width[ch] != NULL
|
||||
&& (strcmp (unicode_width[ch], "W") == 0
|
||||
|| strcmp (unicode_width[ch], "F") == 0))
|
||||
&& (streq (unicode_width[ch], "W")
|
||||
|| streq (unicode_width[ch], "F")))
|
||||
return '2';
|
||||
/* Test for half-width character. */
|
||||
if (unicode_width[ch] != NULL
|
||||
&& strcmp (unicode_width[ch], "H") == 0)
|
||||
&& streq (unicode_width[ch], "H"))
|
||||
return '1';
|
||||
}
|
||||
/* In ancient CJK encodings, Cyrillic and most other characters are
|
||||
@@ -7266,9 +7272,9 @@ static int
|
||||
get_lbea (unsigned int ch)
|
||||
{
|
||||
return (unicode_width[ch] != NULL
|
||||
&& (strcmp (unicode_width[ch], "W") == 0
|
||||
|| strcmp (unicode_width[ch], "F") == 0
|
||||
|| strcmp (unicode_width[ch], "H") == 0));
|
||||
&& (streq (unicode_width[ch], "W")
|
||||
|| streq (unicode_width[ch], "F")
|
||||
|| streq (unicode_width[ch], "H")));
|
||||
}
|
||||
|
||||
/* Returns the line breaking classification for ch, as a bit mask. */
|
||||
@@ -8809,7 +8815,7 @@ fill_org_lbp (const char *linebreak_filename)
|
||||
/* Remove trailing spaces from field1. */
|
||||
while (strlen (field1) > 0 && field1[strlen (field1) - 1] == ' ')
|
||||
field1[strlen (field1) - 1] = '\0';
|
||||
#define TRY(bit) else if (strcmp (field1, #bit + 4) == 0) value = bit;
|
||||
#define TRY(bit) else if (streq (field1, #bit + 4)) value = bit;
|
||||
if (false) {}
|
||||
TRY(LBP_BK)
|
||||
TRY(LBP_CR)
|
||||
@@ -8857,9 +8863,9 @@ fill_org_lbp (const char *linebreak_filename)
|
||||
TRY(LBP_EM)
|
||||
TRY(LBP_XX)
|
||||
#undef TRY
|
||||
else if (strcmp (field1, "NL") == 0) value = LBP_BK;
|
||||
else if (strcmp (field1, "SG") == 0) value = LBP_XX;
|
||||
else if (strcmp (field1, "CJ") == 0) value = LBP_NS;
|
||||
else if (streq (field1, "NL")) value = LBP_BK;
|
||||
else if (streq (field1, "SG")) value = LBP_XX;
|
||||
else if (streq (field1, "CJ")) value = LBP_NS;
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "unknown property value \"%s\" in '%s':%d\n",
|
||||
@@ -9651,12 +9657,12 @@ get_wbp (unsigned int ch)
|
||||
if (((unicode_properties[ch] >> PROP_GRAPHEME_EXTEND) & 1) != 0
|
||||
|| ((unicode_properties[ch] >> PROP_OTHER_GRAPHEME_EXTEND) & 1) != 0
|
||||
|| (unicode_attributes[ch].category != NULL
|
||||
&& strcmp (unicode_attributes[ch].category, "Mc") == 0)
|
||||
&& streq (unicode_attributes[ch].category, "Mc"))
|
||||
|| ((unicode_properties[ch] >> PROP_EMOJI_MODIFIER) & 1) != 0 /* Emoji modifier */)
|
||||
attr |= 1 << WBP_EXTEND;
|
||||
|
||||
if (unicode_attributes[ch].category != NULL
|
||||
&& strcmp (unicode_attributes[ch].category, "Cf") == 0
|
||||
&& streq (unicode_attributes[ch].category, "Cf")
|
||||
&& !(ch >= 0x0600 && ch <= 0x0605)
|
||||
&& ch != 0x06DD
|
||||
&& ch != 0x070F
|
||||
@@ -9667,15 +9673,15 @@ get_wbp (unsigned int ch)
|
||||
attr |= 1 << WBP_FORMAT;
|
||||
|
||||
if ((unicode_scripts[ch] < numscripts
|
||||
&& strcmp (scripts[unicode_scripts[ch]], "Katakana") == 0)
|
||||
&& streq (scripts[unicode_scripts[ch]], "Katakana"))
|
||||
|| (ch >= 0x3031 && ch <= 0x3035)
|
||||
|| ch == 0x309B || ch == 0x309C || ch == 0x30A0 || ch == 0x30FC
|
||||
|| ch == 0xFF70)
|
||||
attr |= 1 << WBP_KATAKANA;
|
||||
|
||||
if ((unicode_scripts[ch] < numscripts
|
||||
&& strcmp (scripts[unicode_scripts[ch]], "Hebrew") == 0)
|
||||
&& strcmp (unicode_attributes[ch].category, "Lo") == 0)
|
||||
&& streq (scripts[unicode_scripts[ch]], "Hebrew"))
|
||||
&& streq (unicode_attributes[ch].category, "Lo"))
|
||||
attr |= 1 << WBP_HL;
|
||||
|
||||
if ((((unicode_properties[ch] >> PROP_ALPHABETIC) & 1) != 0
|
||||
@@ -9698,7 +9704,7 @@ get_wbp (unsigned int ch)
|
||||
&& (attr & (1 << WBP_KATAKANA)) == 0
|
||||
&& ((get_lbp (ch) >> LBP_SA) & 1) == 0
|
||||
&& !(unicode_scripts[ch] < numscripts
|
||||
&& strcmp (scripts[unicode_scripts[ch]], "Hiragana") == 0)
|
||||
&& streq (scripts[unicode_scripts[ch]], "Hiragana"))
|
||||
&& (attr & (1 << WBP_EXTEND)) == 0
|
||||
&& (attr & (1 << WBP_HL)) == 0)
|
||||
attr |= 1 << WBP_ALETTER;
|
||||
@@ -9728,7 +9734,7 @@ get_wbp (unsigned int ch)
|
||||
attr |= 1 << WBP_NUMERIC;
|
||||
|
||||
if ((unicode_attributes[ch].category != NULL
|
||||
&& strcmp (unicode_attributes[ch].category, "Pc") == 0)
|
||||
&& streq (unicode_attributes[ch].category, "Pc"))
|
||||
|| ch == 0x202F /* NARROW NO-BREAK SPACE */)
|
||||
attr |= 1 << WBP_EXTENDNUMLET;
|
||||
|
||||
@@ -9875,7 +9881,7 @@ fill_org_wbp (const char *wordbreakproperty_filename)
|
||||
i2 = i1;
|
||||
}
|
||||
#define PROP(name,value) \
|
||||
if (strcmp (propname, name) == 0) propvalue = value; else
|
||||
if (streq (propname, name)) propvalue = value; else
|
||||
PROP ("CR", WBP_CR)
|
||||
PROP ("LF", WBP_LF)
|
||||
PROP ("Newline", WBP_NEWLINE)
|
||||
@@ -10455,7 +10461,7 @@ fill_org_gbp (const char *graphemebreakproperty_filename)
|
||||
i2 = i1;
|
||||
}
|
||||
#define PROP(name,value) \
|
||||
if (strcmp (propname, name) == 0) propvalue = value; else
|
||||
if (streq (propname, name)) propvalue = value; else
|
||||
PROP ("CR", GBP_CR)
|
||||
PROP ("LF", GBP_LF)
|
||||
PROP ("Control", GBP_CONTROL)
|
||||
@@ -10863,13 +10869,13 @@ debug_output_composition_tables (const char *filename)
|
||||
|
||||
/* Exclude decompositions where the first part is not a starter,
|
||||
i.e. is not of canonical combining class 0. */
|
||||
if (strcmp (unicode_attributes[code1].combining, "0") == 0
|
||||
if (streq (unicode_attributes[code1].combining, "0")
|
||||
/* Exclude characters listed in CompositionExclusions.txt. */
|
||||
&& !unicode_composition_exclusions[combined])
|
||||
{
|
||||
/* The combined character must now also be a starter.
|
||||
Verify this. */
|
||||
assert (strcmp (unicode_attributes[combined].combining, "0") == 0);
|
||||
assert (streq (unicode_attributes[combined].combining, "0"));
|
||||
|
||||
fprintf (stream, "0x%04X\t0x%04X\t0x%04X\t%s\n",
|
||||
code1,
|
||||
@@ -10965,13 +10971,13 @@ output_composition_tables (const char *filename, const char *filename2,
|
||||
|
||||
/* Exclude decompositions where the first part is not a starter,
|
||||
i.e. is not of canonical combining class 0. */
|
||||
if (strcmp (unicode_attributes[code1].combining, "0") == 0
|
||||
if (streq (unicode_attributes[code1].combining, "0")
|
||||
/* Exclude characters listed in CompositionExclusions.txt. */
|
||||
&& !unicode_composition_exclusions[combined])
|
||||
{
|
||||
/* The combined character must now also be a starter.
|
||||
Verify this. */
|
||||
assert (strcmp (unicode_attributes[combined].combining, "0") == 0);
|
||||
assert (streq (unicode_attributes[combined].combining, "0"));
|
||||
|
||||
if (max_code1 < code1)
|
||||
max_code1 = code1;
|
||||
@@ -11120,8 +11126,8 @@ output_simple_mapping (const char *filename,
|
||||
fprintf (stream, "/* Copyright (C) 2000-2025 Free Software Foundation, Inc.\n");
|
||||
fprintf (stream, "\n");
|
||||
output_library_license (stream,
|
||||
strcmp (filename, "unicase/tolower.h") == 0
|
||||
|| strcmp (filename, "unicase/toupper.h") == 0);
|
||||
streq (filename, "unicase/tolower.h")
|
||||
|| streq (filename, "unicase/toupper.h"));
|
||||
fprintf (stream, "\n");
|
||||
|
||||
t.p = 7;
|
||||
@@ -11710,7 +11716,7 @@ redistribute_casefolding_rules (void)
|
||||
if (rule->code == cfrule->code
|
||||
&& (cfrule->language == NULL
|
||||
|| (rule->language != NULL
|
||||
&& strcmp (rule->language, cfrule->language) == 0)))
|
||||
&& streq (rule->language, cfrule->language))))
|
||||
{
|
||||
memcpy (rule->casefold_mapping, cfrule->mapping,
|
||||
sizeof (rule->casefold_mapping));
|
||||
@@ -11718,7 +11724,7 @@ redistribute_casefolding_rules (void)
|
||||
if ((cfrule->language == NULL
|
||||
? rule->language == NULL
|
||||
: rule->language != NULL
|
||||
&& strcmp (rule->language, cfrule->language) == 0)
|
||||
&& streq (rule->language, cfrule->language))
|
||||
&& rule->context == SCC_ALWAYS)
|
||||
{
|
||||
/* Found it. */
|
||||
|
||||
@@ -60,7 +60,7 @@ map_to_failure (int ret, char **con)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ret == 10 && strcmp (*con, "unlabeled") == 0)
|
||||
if (ret == 10 && streq (*con, "unlabeled"))
|
||||
{
|
||||
freecon (*con);
|
||||
*con = NULL;
|
||||
|
||||
@@ -94,7 +94,7 @@ getlogin (void)
|
||||
{
|
||||
idx_t i;
|
||||
for (i = 0; i < n; i++)
|
||||
if (strcmp (entries[i].ut_line, tty + 5) == 0)
|
||||
if (streq (entries[i].ut_line, tty + 5))
|
||||
{
|
||||
if (strlen (entries[i].ut_user) < 64)
|
||||
{
|
||||
|
||||
@@ -48,8 +48,6 @@ getugroups (_GL_UNUSED int maxcount,
|
||||
#else /* HAVE_GRP_H */
|
||||
# include <grp.h>
|
||||
|
||||
# define STREQ(a, b) (strcmp (a, b) == 0)
|
||||
|
||||
/* Like 'getgroups', but for user USERNAME instead of for the current
|
||||
process. Store at most MAXCOUNT group IDs in the GROUPLIST array.
|
||||
If GID is not -1, store it first (if possible). GID should be the
|
||||
@@ -85,7 +83,7 @@ getugroups (int maxcount, gid_t *grouplist, char const *username,
|
||||
{
|
||||
int n;
|
||||
|
||||
if ( ! STREQ (username, *cp))
|
||||
if (!streq (username, *cp))
|
||||
continue;
|
||||
|
||||
/* See if this group number is already on the list. */
|
||||
|
||||
@@ -32,7 +32,7 @@ hard_locale (int category)
|
||||
if (setlocale_null_r (category, locale, sizeof (locale)))
|
||||
return false;
|
||||
|
||||
if (!(strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0))
|
||||
if (!(streq (locale, "C") || streq (locale, "POSIX")))
|
||||
return true;
|
||||
|
||||
#if defined __ANDROID__
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#include "hashcode-string2.h"
|
||||
#include "same-inode.h"
|
||||
|
||||
#define STREQ(a, b) (strcmp (a, b) == 0)
|
||||
|
||||
/* Hash an F_triple, and *do* consider the file name. */
|
||||
size_t
|
||||
triple_hash (void const *x, size_t table_size)
|
||||
@@ -46,7 +44,7 @@ triple_compare_ino_str (void const *x, void const *y)
|
||||
{
|
||||
struct F_triple const *a = x;
|
||||
struct F_triple const *b = y;
|
||||
return PSAME_INODE (a, b) && STREQ (a->name, b->name);
|
||||
return PSAME_INODE (a, b) && streq (a->name, b->name);
|
||||
}
|
||||
|
||||
/* Free an F_triple. */
|
||||
|
||||
@@ -27,7 +27,7 @@ hashkey_string_equals (const void *x1, const void *x2)
|
||||
{
|
||||
const char *s1 = (const char *) x1;
|
||||
const char *s2 = (const char *) x2;
|
||||
return strcmp (s1, s2) == 0;
|
||||
return streq (s1, s2);
|
||||
}
|
||||
|
||||
#define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
|
||||
|
||||
@@ -67,7 +67,7 @@ rpl_iconv_open (const char *tocode, const char *fromcode)
|
||||
&& c_toupper (tocode[2]) == 'F'
|
||||
&& tocode[3] == '-')
|
||||
{
|
||||
if (strcmp (fromcode + 4, "8") == 0)
|
||||
if (streq (fromcode + 4, "8"))
|
||||
{
|
||||
if (c_strcasecmp (tocode + 4, "16BE") == 0)
|
||||
return _ICONV_UTF8_UTF16BE;
|
||||
@@ -78,7 +78,7 @@ rpl_iconv_open (const char *tocode, const char *fromcode)
|
||||
if (c_strcasecmp (tocode + 4, "32LE") == 0)
|
||||
return _ICONV_UTF8_UTF32LE;
|
||||
}
|
||||
else if (strcmp (tocode + 4, "8") == 0)
|
||||
else if (streq (tocode + 4, "8"))
|
||||
{
|
||||
if (c_strcasecmp (fromcode + 4, "16BE") == 0)
|
||||
return _ICONV_UTF16BE_UTF8;
|
||||
|
||||
@@ -109,12 +109,12 @@ getuidbyname (const char *user)
|
||||
|
||||
for (tail = user_alist; tail; tail = tail->next)
|
||||
/* Avoid a function call for the most common case. */
|
||||
if (*tail->name == *user && !strcmp (tail->name, user))
|
||||
if (*tail->name == *user && streq (tail->name, user))
|
||||
return &tail->id.u;
|
||||
|
||||
for (tail = nouser_alist; tail; tail = tail->next)
|
||||
/* Avoid a function call for the most common case. */
|
||||
if (*tail->name == *user && !strcmp (tail->name, user))
|
||||
if (*tail->name == *user && streq (tail->name, user))
|
||||
return NULL;
|
||||
|
||||
pwent = getpwnam (user);
|
||||
@@ -191,12 +191,12 @@ getgidbyname (const char *group)
|
||||
|
||||
for (tail = group_alist; tail; tail = tail->next)
|
||||
/* Avoid a function call for the most common case. */
|
||||
if (*tail->name == *group && !strcmp (tail->name, group))
|
||||
if (*tail->name == *group && streq (tail->name, group))
|
||||
return &tail->id.g;
|
||||
|
||||
for (tail = nogroup_alist; tail; tail = tail->next)
|
||||
/* Avoid a function call for the most common case. */
|
||||
if (*tail->name == *group && !strcmp (tail->name, group))
|
||||
if (*tail->name == *group && streq (tail->name, group))
|
||||
return NULL;
|
||||
|
||||
grent = getgrnam (group);
|
||||
|
||||
@@ -109,7 +109,7 @@ get_converters (const char *encoding)
|
||||
strcpy (conv->encoding, encoding);
|
||||
gl_tls_set (converters_key, conv);
|
||||
}
|
||||
else if (strcmp (conv->encoding, encoding) != 0)
|
||||
else if (!streq (conv->encoding, encoding))
|
||||
{
|
||||
/* The locale encoding of this thread changed. */
|
||||
iconv_t new_cd_locale_to_utf8 = iconv_open ("UTF-8", encoding);
|
||||
|
||||
@@ -811,7 +811,7 @@ locale_charset (void)
|
||||
/* Cygwin < 1.7 does not have locales. nl_langinfo (CODESET) always
|
||||
returns "US-ASCII". Return the suffix of the locale name from the
|
||||
environment variables (if present) or the codepage as a number. */
|
||||
if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
|
||||
if (codeset != NULL && streq (codeset, "US-ASCII"))
|
||||
{
|
||||
const char *locale;
|
||||
static char resultbuf[2 + 10 + 1];
|
||||
@@ -902,8 +902,7 @@ locale_charset (void)
|
||||
/* For a locale name such as "French_France.65001", in Windows 10,
|
||||
setlocale now returns "French_France.utf8" instead, or in the UTF-8
|
||||
environment (with modern system settings) "fr_FR.UTF-8". */
|
||||
if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0
|
||||
|| strcmp (buf + 2, "UTF-8") == 0)
|
||||
if (streq (buf + 2, "65001") || streq (buf + 2, "utf8") || streq (buf + 2, "UTF-8"))
|
||||
codeset = "UTF-8";
|
||||
else
|
||||
{
|
||||
@@ -953,7 +952,7 @@ locale_charset (void)
|
||||
}
|
||||
|
||||
/* For the POSIX locale, don't use the system's codepage. */
|
||||
if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)
|
||||
if (streq (locale, "C") || streq (locale, "POSIX"))
|
||||
codeset = "";
|
||||
}
|
||||
|
||||
@@ -985,7 +984,7 @@ locale_charset (void)
|
||||
Speed up the common case and slow down the less common cases by
|
||||
testing for this case first. */
|
||||
# if defined __OpenBSD__ || (defined __APPLE__ && defined __MACH__) || defined __sun || defined __CYGWIN__
|
||||
if (strcmp (codeset, "UTF-8") == 0)
|
||||
if (streq (codeset, "UTF-8"))
|
||||
goto done_table_lookup;
|
||||
else
|
||||
# endif
|
||||
@@ -1114,7 +1113,7 @@ locale_charset (void)
|
||||
#ifdef DARWIN7
|
||||
/* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
|
||||
(the default codeset) does not work when MB_CUR_MAX is 1. */
|
||||
if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
|
||||
if (ostreq (codeset, "UTF-8") && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
|
||||
codeset = "ASCII";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -44,12 +44,12 @@ gl_locale_name_environ (_GL_UNUSED int category, const char *categoryname)
|
||||
#if HAVE_CFPREFERENCESCOPYAPPVALUE
|
||||
/* Mac OS X 10.2 or newer.
|
||||
Ignore invalid LANG value set by the Terminal application. */
|
||||
if (strcmp (retval, "UTF-8") != 0)
|
||||
if (!streq (retval, "UTF-8"))
|
||||
#endif
|
||||
#if defined __CYGWIN__
|
||||
/* Cygwin.
|
||||
Ignore dummy LANG value set by ~/.profile. */
|
||||
if (strcmp (retval, "C.UTF-8") != 0)
|
||||
if (!streq (retval, "C.UTF-8"))
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1377,7 +1377,7 @@ gl_locale_name_canonicalize (char *name)
|
||||
else
|
||||
i1 = i;
|
||||
}
|
||||
if (strcmp (name, legacy_table[i1].legacy) == 0)
|
||||
if (streq (name, legacy_table[i1].legacy))
|
||||
{
|
||||
strcpy (name, legacy_table[i1].unixy);
|
||||
return;
|
||||
@@ -1401,7 +1401,7 @@ gl_locale_name_canonicalize (char *name)
|
||||
else
|
||||
i1 = i;
|
||||
}
|
||||
if (strcmp (name, langtag_table[i1].langtag) == 0)
|
||||
if (streq (name, langtag_table[i1].langtag))
|
||||
{
|
||||
strcpy (name, langtag_table[i1].unixy);
|
||||
return;
|
||||
@@ -1420,7 +1420,7 @@ gl_locale_name_canonicalize (char *name)
|
||||
else
|
||||
i1 = i;
|
||||
}
|
||||
if (strcmp (name + 3, script_table[i1].script) == 0)
|
||||
if (streq (name + 3, script_table[i1].script))
|
||||
{
|
||||
name[2] = '@';
|
||||
strcpy (name + 3, script_table[i1].unixy);
|
||||
@@ -2593,7 +2593,7 @@ get_lcid (const char *locale_name)
|
||||
/* Lock while looking for an LCID, to protect access to static
|
||||
variables: last_lcid, last_locale, found_lcid, and lname. */
|
||||
glwthread_mutex_lock (&get_lcid_lock);
|
||||
if (last_lcid > 0 && strcmp (locale_name, last_locale) == 0)
|
||||
if (last_lcid > 0 && streq (locale_name, last_locale))
|
||||
{
|
||||
glwthread_mutex_unlock (&get_lcid_lock);
|
||||
return last_lcid;
|
||||
|
||||
@@ -67,7 +67,7 @@ mbs_endswith (const char *string, const char *suffix)
|
||||
if (!mbi_avail (iter))
|
||||
/* We can get here due to incomplete multibyte characters. */
|
||||
return false;
|
||||
return strcmp (mbi_cur_ptr (iter), suffix) == 0;
|
||||
return streq (mbi_cur_ptr (iter), suffix);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -171,21 +171,21 @@
|
||||
#endif
|
||||
|
||||
#define ME_DUMMY_0(Fs_name, Fs_type) \
|
||||
(strcmp (Fs_type, "autofs") == 0 \
|
||||
|| strcmp (Fs_type, "proc") == 0 \
|
||||
|| strcmp (Fs_type, "subfs") == 0 \
|
||||
(streq (Fs_type, "autofs") \
|
||||
|| streq (Fs_type, "proc") \
|
||||
|| streq (Fs_type, "subfs") \
|
||||
/* for Linux 2.6/3.x */ \
|
||||
|| strcmp (Fs_type, "debugfs") == 0 \
|
||||
|| strcmp (Fs_type, "devpts") == 0 \
|
||||
|| strcmp (Fs_type, "fusectl") == 0 \
|
||||
|| strcmp (Fs_type, "fuse.portal") == 0 \
|
||||
|| strcmp (Fs_type, "mqueue") == 0 \
|
||||
|| strcmp (Fs_type, "rpc_pipefs") == 0 \
|
||||
|| strcmp (Fs_type, "sysfs") == 0 \
|
||||
|| streq (Fs_type, "debugfs") \
|
||||
|| streq (Fs_type, "devpts") \
|
||||
|| streq (Fs_type, "fusectl") \
|
||||
|| streq (Fs_type, "fuse.portal") \
|
||||
|| streq (Fs_type, "mqueue") \
|
||||
|| streq (Fs_type, "rpc_pipefs") \
|
||||
|| streq (Fs_type, "sysfs") \
|
||||
/* FreeBSD, Linux 2.4 */ \
|
||||
|| strcmp (Fs_type, "devfs") == 0 \
|
||||
|| streq (Fs_type, "devfs") \
|
||||
/* for NetBSD 3.0 */ \
|
||||
|| strcmp (Fs_type, "kernfs") == 0)
|
||||
|| streq (Fs_type, "kernfs"))
|
||||
|
||||
/* Historically, we have marked as "dummy" any file system of type "none",
|
||||
but now that programs like du need to know about bind-mounted directories,
|
||||
@@ -194,10 +194,10 @@
|
||||
#ifdef MOUNTED_GETMNTENT1
|
||||
# define ME_DUMMY(Fs_name, Fs_type, Bind) \
|
||||
(ME_DUMMY_0 (Fs_name, Fs_type) \
|
||||
|| (strcmp (Fs_type, "none") == 0 && !Bind))
|
||||
|| (streq (Fs_type, "none") && !Bind))
|
||||
#else
|
||||
# define ME_DUMMY(Fs_name, Fs_type) \
|
||||
(ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0)
|
||||
(ME_DUMMY_0 (Fs_name, Fs_type) || streq (Fs_type, "none"))
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
@@ -238,19 +238,19 @@ me_remote (char const *fs_name, _GL_UNUSED char const *fs_type)
|
||||
(strchr (Fs_name, ':') != NULL \
|
||||
|| ((Fs_name)[0] == '/' \
|
||||
&& (Fs_name)[1] == '/' \
|
||||
&& (strcmp (Fs_type, "smbfs") == 0 \
|
||||
|| strcmp (Fs_type, "smb3") == 0 \
|
||||
|| strcmp (Fs_type, "cifs") == 0)) \
|
||||
|| strcmp (Fs_type, "acfs") == 0 \
|
||||
|| strcmp (Fs_type, "afs") == 0 \
|
||||
|| strcmp (Fs_type, "coda") == 0 \
|
||||
|| strcmp (Fs_type, "auristorfs") == 0 \
|
||||
|| strcmp (Fs_type, "fhgfs") == 0 \
|
||||
|| strcmp (Fs_type, "gpfs") == 0 \
|
||||
|| strcmp (Fs_type, "ibrix") == 0 \
|
||||
|| strcmp (Fs_type, "ocfs2") == 0 \
|
||||
|| strcmp (Fs_type, "vxfs") == 0 \
|
||||
|| strcmp ("-hosts", Fs_name) == 0)
|
||||
&& (streq (Fs_type, "smbfs") \
|
||||
|| streq (Fs_type, "smb3") \
|
||||
|| streq (Fs_type, "cifs"))) \
|
||||
|| streq (Fs_type, "acfs") \
|
||||
|| streq (Fs_type, "afs") \
|
||||
|| streq (Fs_type, "coda") \
|
||||
|| streq (Fs_type, "auristorfs") \
|
||||
|| streq (Fs_type, "fhgfs") \
|
||||
|| streq (Fs_type, "gpfs") \
|
||||
|| streq (Fs_type, "ibrix") \
|
||||
|| streq (Fs_type, "ocfs2") \
|
||||
|| streq (Fs_type, "vxfs") \
|
||||
|| streq ("-hosts", Fs_name))
|
||||
#endif
|
||||
|
||||
#if MOUNTED_GETMNTINFO /* Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD */
|
||||
@@ -695,10 +695,10 @@ read_file_system_list (bool need_fs_type)
|
||||
char *name;
|
||||
struct stat statbuf;
|
||||
|
||||
if (strcmp (d->d_name, "..") == 0)
|
||||
if (streq (d->d_name, ".."))
|
||||
continue;
|
||||
|
||||
if (strcmp (d->d_name, ".") == 0)
|
||||
if (streq (d->d_name, "."))
|
||||
name = xstrdup ("/");
|
||||
else
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ newlocale (int category_mask, const char *name, locale_t base)
|
||||
if (category_mask != 0)
|
||||
{
|
||||
/* Test whether NAME is valid. */
|
||||
if (!(strcmp (name, "C") == 0 || strcmp (name, "POSIX") == 0))
|
||||
if (!(streq (name, "C") || streq (name, "POSIX")))
|
||||
{
|
||||
char *filename = (char *) malloc (18 + strlen (name) + 9 + 1);
|
||||
if (filename == NULL)
|
||||
@@ -110,13 +110,13 @@ newlocale (int category_mask, const char *name, locale_t base)
|
||||
}
|
||||
|
||||
/* Canonicalize the name. */
|
||||
if (strcmp (name, "POSIX") == 0)
|
||||
if (streq (name, "POSIX"))
|
||||
name = "C";
|
||||
|
||||
# if !HAVE_WINDOWS_LOCALE_T
|
||||
/* In this case, the only NAMEs that we support are "C" and (equivalently)
|
||||
"POSIX". */
|
||||
if (category_mask != 0 && strcmp (name, "C") != 0)
|
||||
if (category_mask != 0 && !streq (name, "C"))
|
||||
{
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
@@ -164,7 +164,7 @@ newlocale (int category_mask, const char *name, locale_t base)
|
||||
err = ENOMEM;
|
||||
goto fail_with_err;
|
||||
}
|
||||
if (strcmp (lcname, "C") == 0)
|
||||
if (streq (lcname, "C"))
|
||||
{
|
||||
result->category[i].is_c_locale = true;
|
||||
# if HAVE_WINDOWS_LOCALE_T
|
||||
|
||||
@@ -128,7 +128,7 @@ ctype_codeset (void)
|
||||
sprintf (buf + 2, "%u", GetACP ());
|
||||
/* For a locale name such as "French_France.65001", in Windows 10,
|
||||
setlocale now returns "French_France.utf8" instead. */
|
||||
if (strcmp (buf + 2, "65001") == 0 || strcmp (buf + 2, "utf8") == 0)
|
||||
if (streq (buf + 2, "65001") || streq (buf + 2, "utf8"))
|
||||
return (char *) "UTF-8";
|
||||
else
|
||||
{
|
||||
|
||||
@@ -392,7 +392,7 @@ cgroup2_mount (void)
|
||||
return NULL;
|
||||
while ((mnt = getmntent (fp)) != NULL)
|
||||
{
|
||||
if (strcmp (mnt->mnt_type, "cgroup2") == 0)
|
||||
if (streq (mnt->mnt_type, "cgroup2"))
|
||||
{
|
||||
ret = strdup (mnt->mnt_dir);
|
||||
break;
|
||||
|
||||
@@ -94,7 +94,7 @@ open (const char *filename, int flags, ...)
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 && ! defined __CYGWIN__
|
||||
if (strcmp (filename, "/dev/null") == 0)
|
||||
if (streq (filename, "/dev/null"))
|
||||
filename = "NUL";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ spawnpvech (int mode,
|
||||
#endif
|
||||
|
||||
if (!(libcx_spawn2_loaded
|
||||
|| (currdir == NULL || strcmp (currdir, ".") == 0)))
|
||||
|| (currdir == NULL || streq (currdir, "."))))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@@ -219,7 +219,7 @@ spawnpvech (int mode,
|
||||
|| dup2 (new_stderr, STDERR_FILENO) >= 0))
|
||||
{
|
||||
if (!libcx_spawn2_loaded
|
||||
|| (currdir == NULL || strcmp (currdir, ".") == 0))
|
||||
|| (currdir == NULL || streq (currdir, ".")))
|
||||
ret = spawnvpe (mode, progname, (char * const *) argv,
|
||||
(char * const *) envp);
|
||||
#if HAVE_LIBCX_SPAWN2_H
|
||||
|
||||
@@ -88,8 +88,6 @@
|
||||
|
||||
#define HOUR(x) (60 * 60 * (x))
|
||||
|
||||
#define STREQ(a, b) (strcmp (a, b) == 0)
|
||||
|
||||
/* Verify that time_t is an integer as POSIX requires, and that every
|
||||
time_t value fits in intmax_t. Please file a bug report if these
|
||||
assumptions are false on your platform. */
|
||||
@@ -1312,17 +1310,17 @@ lookup_zone (parser_control const *pc, char const *name)
|
||||
table const *tp;
|
||||
|
||||
for (tp = universal_time_zone_table; tp->name; tp++)
|
||||
if (strcmp (name, tp->name) == 0)
|
||||
if (streq (name, tp->name))
|
||||
return tp;
|
||||
|
||||
/* Try local zone abbreviations before those in time_zone_table, as
|
||||
the local ones are more likely to be right. */
|
||||
for (tp = pc->local_time_zone_table; tp->name; tp++)
|
||||
if (strcmp (name, tp->name) == 0)
|
||||
if (streq (name, tp->name))
|
||||
return tp;
|
||||
|
||||
for (tp = time_zone_table; tp->name; tp++)
|
||||
if (strcmp (name, tp->name) == 0)
|
||||
if (streq (name, tp->name))
|
||||
return tp;
|
||||
|
||||
return NULL;
|
||||
@@ -1370,7 +1368,7 @@ lookup_word (parser_control const *pc, char *word)
|
||||
*p = c_toupper (to_uchar (*p));
|
||||
|
||||
for (tp = meridian_table; tp->name; tp++)
|
||||
if (strcmp (word, tp->name) == 0)
|
||||
if (streq (word, tp->name))
|
||||
return tp;
|
||||
|
||||
/* See if we have an abbreviation for a month. */
|
||||
@@ -1384,11 +1382,11 @@ lookup_word (parser_control const *pc, char *word)
|
||||
if ((tp = lookup_zone (pc, word)))
|
||||
return tp;
|
||||
|
||||
if (strcmp (word, dst_table[0].name) == 0)
|
||||
if (streq (word, dst_table[0].name))
|
||||
return dst_table;
|
||||
|
||||
for (tp = time_units_table; tp->name; tp++)
|
||||
if (strcmp (word, tp->name) == 0)
|
||||
if (streq (word, tp->name))
|
||||
return tp;
|
||||
|
||||
/* Strip off any plural and try the units table again. */
|
||||
@@ -1396,13 +1394,13 @@ lookup_word (parser_control const *pc, char *word)
|
||||
{
|
||||
word[wordlen - 1] = '\0';
|
||||
for (tp = time_units_table; tp->name; tp++)
|
||||
if (strcmp (word, tp->name) == 0)
|
||||
if (streq (word, tp->name))
|
||||
return tp;
|
||||
word[wordlen - 1] = 'S'; /* For "this" in relative_time_table. */
|
||||
}
|
||||
|
||||
for (tp = relative_time_table; tp->name; tp++)
|
||||
if (strcmp (word, tp->name) == 0)
|
||||
if (streq (word, tp->name))
|
||||
return tp;
|
||||
|
||||
/* Military time zones. */
|
||||
@@ -1879,8 +1877,8 @@ parse_datetime_body (struct timespec *result, char const *p,
|
||||
populate_local_time_zone_table (&pc, &probe_tm);
|
||||
if (pc.local_time_zone_table[1].name)
|
||||
{
|
||||
if (! strcmp (pc.local_time_zone_table[0].name,
|
||||
pc.local_time_zone_table[1].name))
|
||||
if (streq (pc.local_time_zone_table[0].name,
|
||||
pc.local_time_zone_table[1].name))
|
||||
{
|
||||
/* This locale uses the same abbreviation for standard and
|
||||
daylight times. So if we see that abbreviation, we don't
|
||||
@@ -1919,7 +1917,7 @@ parse_datetime_body (struct timespec *result, char const *p,
|
||||
{
|
||||
if (tz != tzdefault)
|
||||
fprintf (stderr, _("TZ=\"%s\" in date string"), tzstring);
|
||||
else if (STREQ (tzstring, "UTC0"))
|
||||
else if (streq (tzstring, "UTC0"))
|
||||
{
|
||||
/* Special case: 'date -u' sets TZ="UTC0". */
|
||||
fputs (_("TZ=\"UTC0\" environment value or -u"), stderr);
|
||||
@@ -2324,7 +2322,7 @@ parse_datetime_body (struct timespec *result, char const *p,
|
||||
/* Special case: using 'date -u' simply set TZ=UTC0 */
|
||||
if (! tzstring)
|
||||
dbg_fputs (_("timezone: system default\n"));
|
||||
else if (STREQ (tzstring, "UTC0"))
|
||||
else if (streq (tzstring, "UTC0"))
|
||||
dbg_fputs (_("timezone: Universal Time\n"));
|
||||
else
|
||||
dbg_printf (_("timezone: TZ=\"%s\" environment value\n"), tzstring);
|
||||
|
||||
@@ -30,9 +30,9 @@ FILE *
|
||||
popen (const char *filename, const char *mode)
|
||||
{
|
||||
/* Use binary mode by default. */
|
||||
if (strcmp (mode, "r") == 0)
|
||||
if (streq (mode, "r"))
|
||||
mode = "rb";
|
||||
else if (strcmp (mode, "w") == 0)
|
||||
else if (streq (mode, "w"))
|
||||
mode = "wb";
|
||||
|
||||
return _popen (filename, mode);
|
||||
|
||||
@@ -285,7 +285,7 @@ find_executable (const char *argv0)
|
||||
link = xreadlink ("/proc/curproc/file");
|
||||
if (link != NULL)
|
||||
{
|
||||
if (strcmp (link, "unknown") != 0)
|
||||
if (!streq (link, "unknown"))
|
||||
return link;
|
||||
free (link);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ proper_name_utf8 (const char *name_ascii, const char *name_utf8)
|
||||
/* See whether we have a translation. Some translators have not understood
|
||||
that they should use the UTF-8 form of the name, if possible. So if the
|
||||
translator provided a no-op translation, we ignore it. */
|
||||
if (strcmp (translation, name_ascii) != 0)
|
||||
if (!streq (translation, name_ascii))
|
||||
{
|
||||
/* See whether the translation contains the original name. */
|
||||
if (mbsstr_trimmed_wordbounded (translation, name_ascii)
|
||||
|
||||
@@ -85,7 +85,7 @@ main (int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* It would be possible to drop setuid/setgid privileges here. But it is not
|
||||
really needed, since the code below only calls strcmp and [f]printf. */
|
||||
really needed, since the code below only calls streq and [f]printf. */
|
||||
|
||||
{
|
||||
int do_help = 0;
|
||||
@@ -98,14 +98,14 @@ main (int argc, char *argv[])
|
||||
|
||||
if (arg[0] == '-')
|
||||
{
|
||||
if (strcmp (arg, "--") == 0)
|
||||
if (streq (arg, "--"))
|
||||
{
|
||||
remaining++;
|
||||
break;
|
||||
}
|
||||
else if (strcmp (arg, "--help") == 0)
|
||||
else if (streq (arg, "--help"))
|
||||
do_help = 1;
|
||||
else if (strcmp (arg, "--version") == 0)
|
||||
else if (streq (arg, "--version"))
|
||||
do_version = 1;
|
||||
else
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ putenv (char *string)
|
||||
name_x[name_end - string + 2] = 0;
|
||||
putenv_result = _putenv (name_x);
|
||||
for (ep = environ; *ep; ep++)
|
||||
if (strcmp (*ep, name_x) == 0)
|
||||
if (streq (*ep, name_x))
|
||||
{
|
||||
*ep = string;
|
||||
break;
|
||||
|
||||
@@ -50,9 +50,9 @@ is_attr_permissions (const char *name, struct error_context *ctx)
|
||||
{
|
||||
/* We need to explicitly test for the known extended attribute names,
|
||||
because at least on CentOS 7, attr_copy_action does not do it. */
|
||||
return strcmp (name, XATTR_NAME_POSIX_ACL_ACCESS) == 0
|
||||
|| strcmp (name, XATTR_NAME_POSIX_ACL_DEFAULT) == 0
|
||||
|| strcmp (name, XATTR_NAME_NFSV4_ACL) == 0
|
||||
return streq (name, XATTR_NAME_POSIX_ACL_ACCESS)
|
||||
|| streq (name, XATTR_NAME_POSIX_ACL_DEFAULT)
|
||||
|| streq (name, XATTR_NAME_NFSV4_ACL)
|
||||
|| attr_copy_action (name, ctx) == ATTR_ACTION_PERMISSIONS;
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
SET_UTMP_ENT ();
|
||||
|
||||
# if (defined __linux__ && !defined __ANDROID__) || defined __minix
|
||||
bool file_is_utmp = (strcmp (file, UTMP_FILE) == 0);
|
||||
bool file_is_utmp = streq (file, UTMP_FILE);
|
||||
/* Timestamp of the "runlevel" entry, if any. */
|
||||
struct timespec runlevel_ts = {0};
|
||||
# endif
|
||||
@@ -457,7 +457,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
it produces wrong values after the date has been bumped in the running
|
||||
system. */
|
||||
if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
|
||||
&& strcmp (file, UTMP_FILE) == 0
|
||||
&& streq (file, UTMP_FILE)
|
||||
&& !have_boot_time (a))
|
||||
{
|
||||
struct timespec boot_time;
|
||||
@@ -556,7 +556,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (file, UTMP_FILE) != 0)
|
||||
if (!streq (file, UTMP_FILE))
|
||||
{
|
||||
int saved_errno = errno;
|
||||
free (a.utmp);
|
||||
@@ -567,7 +567,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
|
||||
# if defined __OpenBSD__
|
||||
if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
|
||||
&& strcmp (file, UTMP_FILE) == 0
|
||||
&& streq (file, UTMP_FILE)
|
||||
&& !have_boot_time (a))
|
||||
{
|
||||
struct timespec boot_time;
|
||||
@@ -585,7 +585,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
|
||||
# if defined __linux__ && !defined __ANDROID__
|
||||
if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
|
||||
&& strcmp (file, UTMP_FILE) == 0
|
||||
&& streq (file, UTMP_FILE)
|
||||
&& !have_boot_time (a))
|
||||
{
|
||||
struct timespec boot_time;
|
||||
@@ -604,7 +604,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
&& defined CTL_KERN && defined KERN_BOOTTIME \
|
||||
&& !defined __minix
|
||||
if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
|
||||
&& strcmp (file, UTMP_FILE) == 0
|
||||
&& streq (file, UTMP_FILE)
|
||||
&& !have_boot_time (a))
|
||||
{
|
||||
struct timespec boot_time;
|
||||
@@ -620,7 +620,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
|
||||
# if defined __HAIKU__
|
||||
if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
|
||||
&& strcmp (file, UTMP_FILE) == 0
|
||||
&& streq (file, UTMP_FILE)
|
||||
&& !have_boot_time (a))
|
||||
{
|
||||
struct timespec boot_time;
|
||||
@@ -636,7 +636,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
|
||||
# if HAVE_OS_H /* BeOS, Haiku */
|
||||
if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
|
||||
&& strcmp (file, UTMP_FILE) == 0
|
||||
&& streq (file, UTMP_FILE)
|
||||
&& !have_boot_time (a))
|
||||
{
|
||||
struct timespec boot_time;
|
||||
@@ -654,7 +654,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
|
||||
# if defined __CYGWIN__ || defined _WIN32
|
||||
if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
|
||||
&& strcmp (file, UTMP_FILE) == 0
|
||||
&& streq (file, UTMP_FILE)
|
||||
&& !have_boot_time (a))
|
||||
{
|
||||
struct timespec boot_time;
|
||||
@@ -670,7 +670,7 @@ read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
|
||||
# if defined _WIN32 && ! defined __CYGWIN__
|
||||
if ((options & (READ_UTMP_USER_PROCESS | READ_UTMP_NO_BOOT_TIME)) == 0
|
||||
&& strcmp (file, UTMP_FILE) == 0
|
||||
&& streq (file, UTMP_FILE)
|
||||
&& !have_boot_time (a))
|
||||
{
|
||||
struct timespec boot_time;
|
||||
@@ -841,7 +841,7 @@ read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
|
||||
/* Try harder to get a sensible value for the tty. */
|
||||
if (sd_session_get_type (session, &type) < 0)
|
||||
type = missing;
|
||||
if (strcmp (type, "tty") == 0)
|
||||
if (streq (type, "tty"))
|
||||
{
|
||||
char *service;
|
||||
if (sd_session_get_service (session, &service) < 0)
|
||||
@@ -863,7 +863,7 @@ read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
|
||||
else if (pty != NULL)
|
||||
tty = pty;
|
||||
}
|
||||
else if (strcmp (type, "web") == 0)
|
||||
else if (streq (type, "web"))
|
||||
{
|
||||
char *service;
|
||||
if (sd_session_get_service (session, &service) < 0)
|
||||
@@ -901,7 +901,7 @@ read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
|
||||
host field. */
|
||||
if (!type && sd_session_get_type (session, &type) < 0)
|
||||
type = missing;
|
||||
if (strcmp (type, "x11") == 0)
|
||||
if (streq (type, "x11"))
|
||||
{
|
||||
char *display;
|
||||
if (sd_session_get_display (session, &display) < 0)
|
||||
@@ -978,7 +978,7 @@ read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
|
||||
int options)
|
||||
{
|
||||
# if READUTMP_USE_SYSTEMD
|
||||
if (strcmp (file, UTMP_FILE) == 0)
|
||||
if (streq (file, UTMP_FILE))
|
||||
/* Imitate reading UTMP_FILE, using systemd and Linux APIs. */
|
||||
return read_utmp_from_systemd (n_entries, utmp_buf, options);
|
||||
# endif
|
||||
|
||||
@@ -90,7 +90,7 @@ localized_pattern (const char *english_pattern, nl_item nl_index,
|
||||
static int
|
||||
try (const char *response, const char *pattern, char **lastp, regex_t *re)
|
||||
{
|
||||
if (*lastp == NULL || strcmp (pattern, *lastp) != 0)
|
||||
if (*lastp == NULL || !streq (pattern, *lastp))
|
||||
{
|
||||
char *safe_pattern;
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ fill_lc_all_name (void)
|
||||
{
|
||||
bool all_same = true;
|
||||
for (size_t i = 1; i < 12; i++)
|
||||
if (strcmp (lc_cat_name[i], lc_cat_name[0]) != 0)
|
||||
if (!streq (lc_cat_name[i], lc_cat_name[0]))
|
||||
{
|
||||
all_same = false;
|
||||
break;
|
||||
|
||||
@@ -686,7 +686,7 @@ setlocale_unixlike (int category, const char *locale)
|
||||
|
||||
/* The native Windows implementation of setlocale understands the special
|
||||
locale name "C", but not "POSIX". Therefore map "POSIX" to "C". */
|
||||
if (locale != NULL && strcmp (locale, "POSIX") == 0)
|
||||
if (locale != NULL && streq (locale, "POSIX"))
|
||||
locale = "C";
|
||||
|
||||
/* The native Windows implementation of setlocale, in the UTF-8 environment,
|
||||
@@ -694,8 +694,8 @@ setlocale_unixlike (int category, const char *locale)
|
||||
but it understands "English_United States.65001", which is functionally
|
||||
equivalent. */
|
||||
if (locale != NULL
|
||||
&& ((is_utf8 && strcmp (locale, "C") == 0)
|
||||
|| strcmp (locale, "C.UTF-8") == 0))
|
||||
&& ((is_utf8 && streq (locale, "C"))
|
||||
|| streq (locale, "C.UTF-8")))
|
||||
locale = "English_United States.65001";
|
||||
|
||||
/* First, try setlocale with the original argument unchanged. */
|
||||
@@ -728,7 +728,7 @@ setlocale_unixlike (int category, const char *locale)
|
||||
/* llCC_buf now contains
|
||||
language[_territory][@modifier]
|
||||
*/
|
||||
if (strcmp (llCC_buf, locale) != 0)
|
||||
if (!streq (llCC_buf, locale))
|
||||
{
|
||||
if (is_utf8)
|
||||
{
|
||||
@@ -890,7 +890,7 @@ setlocale_unixlike (int category, const char *locale)
|
||||
case LC_TELEPHONE:
|
||||
case LC_MEASUREMENT:
|
||||
if (locale == NULL
|
||||
|| strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)
|
||||
|| streq (locale, "C") || streq (locale, "POSIX"))
|
||||
result = (char *) "C";
|
||||
break;
|
||||
default:
|
||||
@@ -1501,7 +1501,7 @@ setlocale_improved (int category, const char *locale)
|
||||
LC_CTYPE category to an invalid value ("C") when it does not
|
||||
support the specified encoding. Report a failure instead. */
|
||||
if (strchr (base_name, '.') != NULL
|
||||
&& strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
|
||||
&& streq (setlocale (LC_CTYPE, NULL), "C"))
|
||||
goto fail;
|
||||
# endif
|
||||
|
||||
@@ -1516,7 +1516,7 @@ setlocale_improved (int category, const char *locale)
|
||||
|
||||
/* If name is the same as base_name, it has already been set
|
||||
through the setlocale call before the loop. */
|
||||
if (strcmp (name, base_name) != 0
|
||||
if (!streq (name, base_name)
|
||||
# if LC_MESSAGES == 1729
|
||||
|| cat == LC_MESSAGES
|
||||
# endif
|
||||
@@ -1726,7 +1726,7 @@ setlocale_improved (int category, const char *locale)
|
||||
set the LC_CTYPE category to an invalid value ("C") when
|
||||
it does not support the specified encoding. Report a
|
||||
failure instead. */
|
||||
if (strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
|
||||
if (streq (setlocale (LC_CTYPE, NULL), "C"))
|
||||
{
|
||||
/* Don't risk an endless recursion. */
|
||||
if (saved_locale[0] != '\0')
|
||||
@@ -1778,7 +1778,7 @@ setlocale_improved (int category, const char *locale)
|
||||
{
|
||||
char *name1 = setlocale (LC_ALL, NULL);
|
||||
char *name2 = setlocale_single (LC_MESSAGES, NULL);
|
||||
if (strcmp (name1, name2) == 0)
|
||||
if (streq (name1, name2))
|
||||
/* Not a mixed locale. */
|
||||
return name1;
|
||||
else
|
||||
|
||||
@@ -288,7 +288,7 @@ str2signum (char const *signame)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < NUMNAME_ENTRIES; i++)
|
||||
if (strcmp (numname_table[i].name, signame) == 0)
|
||||
if (streq (numname_table[i].name, signame))
|
||||
return numname_table[i].num;
|
||||
|
||||
{
|
||||
|
||||
@@ -328,7 +328,7 @@ static HANDLE
|
||||
open_handle (const char *name, int flags, mode_t mode)
|
||||
{
|
||||
/* To ease portability. Like in open.c. */
|
||||
if (strcmp (name, "/dev/null") == 0)
|
||||
if (streq (name, "/dev/null"))
|
||||
name = "NUL";
|
||||
|
||||
/* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>
|
||||
|
||||
@@ -112,7 +112,7 @@ rpl_stat (char const *name, struct stat *buf)
|
||||
<https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ? */
|
||||
|
||||
/* To ease portability. Like in open.c. */
|
||||
if (strcmp (name, "/dev/null") == 0)
|
||||
if (streq (name, "/dev/null"))
|
||||
name = "NUL";
|
||||
|
||||
/* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>
|
||||
|
||||
@@ -27,5 +27,5 @@ str_endswith (const char *string, const char *suffix)
|
||||
{
|
||||
size_t len = strlen (string);
|
||||
size_t n = strlen (suffix);
|
||||
return len >= n && strcmp (string + len - n, suffix) == 0;
|
||||
return len >= n && streq (string + len - n, suffix);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ extern "C" {
|
||||
static inline int
|
||||
streq9 (const char *s1, const char *s2)
|
||||
{
|
||||
return strcmp (s1 + 9, s2 + 9) == 0;
|
||||
return streq (s1 + 9, s2 + 9);
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
||||
@@ -160,7 +160,7 @@ mem_iconveha_notranslit (const char *src, size_t srclen,
|
||||
/* Unsupported from_codeset or to_codeset. Check whether the caller
|
||||
requested autodetection. */
|
||||
for (alias = autodetect_list; alias != NULL; alias = alias->next)
|
||||
if (strcmp (from_codeset, alias->name) == 0)
|
||||
if (streq (from_codeset, alias->name))
|
||||
{
|
||||
const char * const *encodings;
|
||||
|
||||
@@ -270,7 +270,7 @@ str_iconveha_notranslit (const char *src,
|
||||
/* Unsupported from_codeset or to_codeset. Check whether the caller
|
||||
requested autodetection. */
|
||||
for (alias = autodetect_list; alias != NULL; alias = alias->next)
|
||||
if (strcmp (from_codeset, alias->name) == 0)
|
||||
if (streq (from_codeset, alias->name))
|
||||
{
|
||||
const char * const *encodings;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ struniq (const char *string)
|
||||
struct struniq_hash_node *new_node;
|
||||
struct struniq_hash_node *p;
|
||||
for (p = struniq_hash_table[slot]; p != NULL; p = p->next)
|
||||
if (strcmp (p->contents, string) == 0)
|
||||
if (streq (p->contents, string))
|
||||
return p->contents;
|
||||
size = strlen (string) + 1;
|
||||
new_node =
|
||||
@@ -101,7 +101,7 @@ struniq (const char *string)
|
||||
/* Check whether another thread already added the string while we were
|
||||
waiting on the lock. */
|
||||
for (p = struniq_hash_table[slot]; p != NULL; p = p->next)
|
||||
if (strcmp (p->contents, string) == 0)
|
||||
if (streq (p->contents, string))
|
||||
{
|
||||
free (new_node);
|
||||
new_node = p;
|
||||
|
||||
@@ -97,7 +97,7 @@ open_supersede (const char *filename, int flags, mode_t mode,
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 && ! defined __CYGWIN__
|
||||
if (strcmp (filename, "/dev/null") == 0)
|
||||
if (streq (filename, "/dev/null"))
|
||||
filename = "NUL";
|
||||
#endif
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ save_abbr (timezone_t tz, struct tm *tm)
|
||||
{
|
||||
zone_copy = tz->abbrs;
|
||||
|
||||
while (strcmp (zone_copy, zone) != 0)
|
||||
while (!streq (zone_copy, zone))
|
||||
{
|
||||
if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set)))
|
||||
{
|
||||
@@ -202,7 +202,7 @@ set_tz (timezone_t tz)
|
||||
{
|
||||
char *env_tz = getenv_TZ ();
|
||||
if (env_tz
|
||||
? tz->tz_is_set && strcmp (tz->abbrs, env_tz) == 0
|
||||
? tz->tz_is_set && streq (tz->abbrs, env_tz)
|
||||
: !tz->tz_is_set)
|
||||
return local_tz;
|
||||
else
|
||||
|
||||
@@ -81,7 +81,7 @@ unicode_to_mb (unsigned int code,
|
||||
{
|
||||
const char *charset = locale_charset ();
|
||||
|
||||
is_utf8 = !strcmp (charset, UTF8_NAME);
|
||||
is_utf8 = streq (charset, UTF8_NAME);
|
||||
#if HAVE_ICONV
|
||||
if (!is_utf8)
|
||||
{
|
||||
|
||||
@@ -439,7 +439,7 @@ thousands_separator_char (char stackbuf[10])
|
||||
stackbuf[strlen (stackbuf) - 3] = '\0';
|
||||
# if defined __sun
|
||||
/* Solaris specific hack: Replace wrong result (0xC2 means U+00A0). */
|
||||
if (strcmp (&stackbuf[1], "\302") == 0)
|
||||
if (streq (&stackbuf[1], "\302"))
|
||||
strcpy (&stackbuf[1], MB_CUR_MAX > 1 ? "\302\240" : "\240");
|
||||
# endif
|
||||
return &stackbuf[1];
|
||||
@@ -524,7 +524,7 @@ thousands_separator_wchar (wchar_t stackbuf[10])
|
||||
/* Now tmp = L"1<thousep>000". */
|
||||
tmp[strlen (tmp) - 3] = '\0';
|
||||
/* Solaris specific hack: Replace wrong result (0xC2 means U+00A0). */
|
||||
if (strcmp (&tmp[1], "\302") == 0)
|
||||
if (streq (&tmp[1], "\302"))
|
||||
strcpy (&tmp[1], MB_CUR_MAX > 1 ? "\302\240" : "\240");
|
||||
if (tmp[1] != '\0')
|
||||
{
|
||||
|
||||
142
lib/vc-mtime.c
142
lib/vc-mtime.c
@@ -381,9 +381,9 @@ abs_git_checkout (void)
|
||||
static long
|
||||
ancestor_level (const char *dir1, const char *dir2)
|
||||
{
|
||||
if (strcmp (dir1, "/") == 0)
|
||||
if (streq (dir1, "/"))
|
||||
dir1 = "";
|
||||
if (strcmp (dir2, "/") == 0)
|
||||
if (streq (dir2, "/"))
|
||||
dir2 = "";
|
||||
size_t dir1_len = strlen (dir1);
|
||||
if (strncmp (dir1, dir2, dir1_len) == 0)
|
||||
@@ -415,14 +415,14 @@ static char *
|
||||
relativize (const char *filename,
|
||||
unsigned long n, const char *dir1, const char *dir2)
|
||||
{
|
||||
if (strcmp (dir1, "/") == 0)
|
||||
if (streq (dir1, "/"))
|
||||
dir1 = "";
|
||||
size_t dir1_len = strlen (dir1);
|
||||
if (!(strncmp (filename, dir1, dir1_len) == 0
|
||||
&& (filename[dir1_len] == '\0' || ISSLASH (filename[dir1_len]))))
|
||||
/* Invalid argument. */
|
||||
abort ();
|
||||
if (strcmp (dir2, "/") == 0)
|
||||
if (streq (dir2, "/"))
|
||||
dir2 = "";
|
||||
|
||||
dir2 += dir1_len;
|
||||
@@ -560,7 +560,7 @@ max_vc_mtime (struct timespec *max_of_mtimes,
|
||||
/* Test which of these absolute file names are outside of the
|
||||
git_checkout. */
|
||||
char *git_checkout_slash =
|
||||
(strcmp (git_checkout, "/") == 0
|
||||
(streq (git_checkout, "/")
|
||||
? xstrdup (git_checkout)
|
||||
: xasprintf ("%s%c", git_checkout, SLASH));
|
||||
|
||||
@@ -1002,75 +1002,75 @@ test_ancestor_level (void)
|
||||
static void
|
||||
test_relativize (void)
|
||||
{
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib",
|
||||
0, "/home/user/projects/gnulib", "/home/user/projects/gnulib"),
|
||||
".") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/NEWS",
|
||||
0, "/home/user/projects/gnulib", "/home/user/projects/gnulib"),
|
||||
"NEWS") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/doc/Makefile",
|
||||
0, "/home/user/projects/gnulib", "/home/user/projects/gnulib"),
|
||||
"doc/Makefile") == 0);
|
||||
assert (streq (relativize ("/home/user/projects/gnulib",
|
||||
0, "/home/user/projects/gnulib", "/home/user/projects/gnulib"),
|
||||
"."));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/NEWS",
|
||||
0, "/home/user/projects/gnulib", "/home/user/projects/gnulib"),
|
||||
"NEWS"));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/doc/Makefile",
|
||||
0, "/home/user/projects/gnulib", "/home/user/projects/gnulib"),
|
||||
"doc/Makefile"));
|
||||
|
||||
assert (strcmp (relativize ("/",
|
||||
0, "/", "/"),
|
||||
".") == 0);
|
||||
assert (strcmp (relativize ("/swapfile",
|
||||
0, "/", "/"),
|
||||
"swapfile") == 0);
|
||||
assert (strcmp (relativize ("/etc/passwd",
|
||||
0, "/", "/"),
|
||||
"etc/passwd") == 0);
|
||||
assert (streq (relativize ("/",
|
||||
0, "/", "/"),
|
||||
"."));
|
||||
assert (streq (relativize ("/swapfile",
|
||||
0, "/", "/"),
|
||||
"swapfile"));
|
||||
assert (streq (relativize ("/etc/passwd",
|
||||
0, "/", "/"),
|
||||
"etc/passwd"));
|
||||
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../../") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/lib",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/lib/crypto",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
".") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/lib/malloc",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../malloc") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/lib/cr",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../cr") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/lib/cryptography",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../cryptography") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/doc",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../../doc") == 0);
|
||||
assert (strcmp (relativize ("/home/user/projects/gnulib/doc/Makefile",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../../doc/Makefile") == 0);
|
||||
assert (streq (relativize ("/home/user/projects/gnulib",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../../"));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/lib",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../"));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/lib/crypto",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"."));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/lib/malloc",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../malloc"));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/lib/cr",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../cr"));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/lib/cryptography",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../cryptography"));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/doc",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../../doc"));
|
||||
assert (streq (relativize ("/home/user/projects/gnulib/doc/Makefile",
|
||||
2, "/home/user/projects/gnulib", "/home/user/projects/gnulib/lib/crypto"),
|
||||
"../../doc/Makefile"));
|
||||
|
||||
assert (strcmp (relativize ("/",
|
||||
2, "/", "/home/user"),
|
||||
"../../") == 0);
|
||||
assert (strcmp (relativize ("/home",
|
||||
2, "/", "/home/user"),
|
||||
"../") == 0);
|
||||
assert (strcmp (relativize ("/home/user",
|
||||
2, "/", "/home/user"),
|
||||
".") == 0);
|
||||
assert (strcmp (relativize ("/home/root",
|
||||
2, "/", "/home/user"),
|
||||
"../root") == 0);
|
||||
assert (strcmp (relativize ("/home/us",
|
||||
2, "/", "/home/user"),
|
||||
"../us") == 0);
|
||||
assert (strcmp (relativize ("/home/users",
|
||||
2, "/", "/home/user"),
|
||||
"../users") == 0);
|
||||
assert (strcmp (relativize ("/etc",
|
||||
2, "/", "/home/user"),
|
||||
"../../etc") == 0);
|
||||
assert (strcmp (relativize ("/etc/passwd",
|
||||
2, "/", "/home/user"),
|
||||
"../../etc/passwd") == 0);
|
||||
assert (streq (relativize ("/",
|
||||
2, "/", "/home/user"),
|
||||
"../../"));
|
||||
assert (streq (relativize ("/home",
|
||||
2, "/", "/home/user"),
|
||||
"../"));
|
||||
assert (streq (relativize ("/home/user",
|
||||
2, "/", "/home/user"),
|
||||
"."));
|
||||
assert (streq (relativize ("/home/root",
|
||||
2, "/", "/home/user"),
|
||||
"../root"));
|
||||
assert (streq (relativize ("/home/us",
|
||||
2, "/", "/home/user"),
|
||||
"../us"));
|
||||
assert (streq (relativize ("/home/users",
|
||||
2, "/", "/home/user"),
|
||||
"../users"));
|
||||
assert (streq (relativize ("/etc",
|
||||
2, "/", "/home/user"),
|
||||
"../../etc"));
|
||||
assert (streq (relativize ("/etc/passwd",
|
||||
2, "/", "/home/user"),
|
||||
"../../etc/passwd"));
|
||||
}
|
||||
|
||||
/* Usage: ./a.out FILE[...]
|
||||
|
||||
@@ -23,11 +23,11 @@ wctrans (const char *name)
|
||||
switch (name[2])
|
||||
{
|
||||
case 'l':
|
||||
if (strcmp (name + 3, "ower") == 0)
|
||||
if (streq (name + 3, "ower"))
|
||||
return (wctrans_t) towlower;
|
||||
break;
|
||||
case 'u':
|
||||
if (strcmp (name + 3, "pper") == 0)
|
||||
if (streq (name + 3, "pper"))
|
||||
return (wctrans_t) towupper;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -27,11 +27,11 @@ wctype (const char* name)
|
||||
switch (name[2])
|
||||
{
|
||||
case 'n':
|
||||
if (strcmp (name + 3, "um") == 0)
|
||||
if (streq (name + 3, "um"))
|
||||
return (wctype_t) iswalnum;
|
||||
break;
|
||||
case 'p':
|
||||
if (strcmp (name + 3, "ha") == 0)
|
||||
if (streq (name + 3, "ha"))
|
||||
return (wctype_t) iswalpha;
|
||||
break;
|
||||
default:
|
||||
@@ -43,34 +43,34 @@ wctype (const char* name)
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (strcmp (name + 1, "lank") == 0)
|
||||
if (streq (name + 1, "lank"))
|
||||
return (wctype_t) iswblank;
|
||||
break;
|
||||
case 'c':
|
||||
if (strcmp (name + 1, "ntrl") == 0)
|
||||
if (streq (name + 1, "ntrl"))
|
||||
return (wctype_t) iswcntrl;
|
||||
break;
|
||||
case 'd':
|
||||
if (strcmp (name + 1, "igit") == 0)
|
||||
if (streq (name + 1, "igit"))
|
||||
return (wctype_t) iswdigit;
|
||||
break;
|
||||
case 'g':
|
||||
if (strcmp (name + 1, "raph") == 0)
|
||||
if (streq (name + 1, "raph"))
|
||||
return (wctype_t) iswgraph;
|
||||
break;
|
||||
case 'l':
|
||||
if (strcmp (name + 1, "ower") == 0)
|
||||
if (streq (name + 1, "ower"))
|
||||
return (wctype_t) iswlower;
|
||||
break;
|
||||
case 'p':
|
||||
switch (name[1])
|
||||
{
|
||||
case 'r':
|
||||
if (strcmp (name + 2, "int") == 0)
|
||||
if (streq (name + 2, "int"))
|
||||
return (wctype_t) iswprint;
|
||||
break;
|
||||
case 'u':
|
||||
if (strcmp (name + 2, "nct") == 0)
|
||||
if (streq (name + 2, "nct"))
|
||||
return (wctype_t) iswpunct;
|
||||
break;
|
||||
default:
|
||||
@@ -78,15 +78,15 @@ wctype (const char* name)
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (strcmp (name + 1, "pace") == 0)
|
||||
if (streq (name + 1, "pace"))
|
||||
return (wctype_t) iswspace;
|
||||
break;
|
||||
case 'u':
|
||||
if (strcmp (name + 1, "pper") == 0)
|
||||
if (streq (name + 1, "pper"))
|
||||
return (wctype_t) iswupper;
|
||||
break;
|
||||
case 'x':
|
||||
if (strcmp (name + 1, "digit") == 0)
|
||||
if (streq (name + 1, "digit"))
|
||||
return (wctype_t) iswxdigit;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -16,6 +16,7 @@ extern-inline
|
||||
fstat
|
||||
minmax
|
||||
stat
|
||||
stringeq
|
||||
bool
|
||||
sys_stat-h
|
||||
stdint-h
|
||||
|
||||
@@ -24,6 +24,7 @@ basename-lgpl
|
||||
extern-inline
|
||||
getopt-gnu
|
||||
strchrnul
|
||||
stringeq
|
||||
sysexits-h
|
||||
malloc-gnu
|
||||
mempcpy
|
||||
|
||||
@@ -10,6 +10,7 @@ uchar-h
|
||||
wctrans
|
||||
c32tolower
|
||||
c32toupper
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
gl_UCHAR_MODULE_INDICATOR([c32_get_mapping])
|
||||
|
||||
@@ -20,6 +20,7 @@ c32ispunct
|
||||
c32isspace
|
||||
c32isupper
|
||||
c32isxdigit
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
gl_UCHAR_MODULE_INDICATOR([c32_get_type_test])
|
||||
|
||||
@@ -10,6 +10,7 @@ Depends-on:
|
||||
filename
|
||||
malloc-posix
|
||||
stpcpy
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ Depends-on:
|
||||
attribute
|
||||
bool
|
||||
c99
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
|
||||
@@ -31,6 +31,7 @@ stdint-h
|
||||
stdio-h
|
||||
stdlib-h
|
||||
string-h
|
||||
stringeq
|
||||
uchar-h
|
||||
# The lonesome_lower array requires ISO C 23 semantics for char32_t.
|
||||
# But uchar-h-c23 has a global effect, therefore leave it to each package
|
||||
|
||||
@@ -10,6 +10,7 @@ locale-h
|
||||
freelocale [test $HAVE_LOCALE_T = 0 || { test $HAVE_DUPLOCALE = 1 && test $REPLACE_DUPLOCALE = 1; }]
|
||||
newlocale [test $HAVE_LOCALE_T = 0 || { test $HAVE_DUPLOCALE = 1 && test $REPLACE_DUPLOCALE = 1; }]
|
||||
setlocale-null [test $HAVE_LOCALE_T = 0 || { test $HAVE_DUPLOCALE = 1 && test $REPLACE_DUPLOCALE = 1; }]
|
||||
stringeq [test $HAVE_LOCALE_T = 0 || { test $HAVE_DUPLOCALE = 1 && test $REPLACE_DUPLOCALE = 1; }]
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_DUPLOCALE
|
||||
|
||||
@@ -17,6 +17,7 @@ mbscasecmp
|
||||
mbuiter [test "$GNULIB_MCEL_PREFER" != yes]
|
||||
nullptr
|
||||
regex
|
||||
stringeq
|
||||
bool
|
||||
unlocked-io-internal
|
||||
xalloc
|
||||
|
||||
@@ -14,6 +14,7 @@ xalloc
|
||||
xconcat-filename
|
||||
access
|
||||
stat
|
||||
stringeq
|
||||
unistd-h
|
||||
|
||||
configure.ac:
|
||||
|
||||
@@ -15,6 +15,7 @@ concat-filename
|
||||
access
|
||||
stat
|
||||
strdup-posix
|
||||
stringeq
|
||||
malloc-posix
|
||||
unistd-h
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ stdio-h
|
||||
largefile
|
||||
fcntl-h [test $REPLACE_FOPEN = 1]
|
||||
bool [test $REPLACE_FOPEN = 1]
|
||||
stringeq [test $REPLACE_FOPEN = 1]
|
||||
unistd-h [test $REPLACE_FOPEN = 1]
|
||||
close [test $REPLACE_FOPEN = 1]
|
||||
fstat [test $REPLACE_FOPEN = 1]
|
||||
|
||||
@@ -9,6 +9,7 @@ fopen
|
||||
open [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
|
||||
fcntl-h [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
|
||||
bool [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
|
||||
stringeq [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
|
||||
unistd-h [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
|
||||
close [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
|
||||
fstat [test $REPLACE_FOPEN_FOR_FOPEN_GNU = 1]
|
||||
|
||||
@@ -7,6 +7,7 @@ m4/freopen.m4
|
||||
|
||||
Depends-on:
|
||||
fcntl-h [test $REPLACE_FREOPEN = 1]
|
||||
stringeq [test $REPLACE_FREOPEN = 1]
|
||||
open [test $REPLACE_FREOPEN = 1]
|
||||
stdio-h
|
||||
largefile
|
||||
|
||||
@@ -40,6 +40,7 @@ realloc-posix
|
||||
bool
|
||||
stddef-h
|
||||
stdint-h
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_FTS
|
||||
|
||||
@@ -12,6 +12,7 @@ extensions
|
||||
getlocalename_l-unsafe [test $HAVE_GETLOCALENAME_L = 0 || test $REPLACE_GETLOCALENAME_L = 1]
|
||||
flexmember [test $HAVE_GETLOCALENAME_L = 0 || test $REPLACE_GETLOCALENAME_L = 1]
|
||||
lock [test $HAVE_GETLOCALENAME_L = 0 || test $REPLACE_GETLOCALENAME_L = 1]
|
||||
stringeq [test $HAVE_GETLOCALENAME_L = 0 || test $REPLACE_GETLOCALENAME_L = 1]
|
||||
bool [test $HAVE_GETLOCALENAME_L = 0 || test $REPLACE_GETLOCALENAME_L = 1]
|
||||
thread-optim [test $HAVE_GETLOCALENAME_L = 0 || test $REPLACE_GETLOCALENAME_L = 1]
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ locale-h
|
||||
getlocalename_l-unsafe-limited
|
||||
flexmember
|
||||
lock
|
||||
stringeq
|
||||
bool
|
||||
thread-optim
|
||||
setlocale-fixes
|
||||
|
||||
@@ -8,6 +8,7 @@ m4/getlogin.m4
|
||||
Depends-on:
|
||||
unistd-h
|
||||
readutmp [test $HAVE_GETLOGIN = 0 || test $REPLACE_GETLOGIN = 1]
|
||||
stringeq [test $HAVE_GETLOGIN = 0 || test $REPLACE_GETLOGIN = 1]
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_GETLOGIN
|
||||
|
||||
@@ -8,6 +8,7 @@ m4/getugroups.m4
|
||||
|
||||
Depends-on:
|
||||
errno-h
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
gl_GETUGROUPS
|
||||
|
||||
@@ -8,6 +8,7 @@ lib/hard-locale.c
|
||||
Depends-on:
|
||||
bool
|
||||
setlocale-null
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
|
||||
|
||||
@@ -9,6 +9,7 @@ lib/hash-triple.h
|
||||
Depends-on:
|
||||
hashcode-string2
|
||||
same-inode
|
||||
stringeq
|
||||
bool
|
||||
|
||||
configure.ac:
|
||||
|
||||
@@ -7,6 +7,7 @@ lib/hashkey-string.c
|
||||
|
||||
Depends-on:
|
||||
bool
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ iconv
|
||||
c-ctype [test $REPLACE_ICONV_OPEN = 1]
|
||||
c-strcasecmp [test $REPLACE_ICONV_OPEN = 1]
|
||||
stdint-h [test $REPLACE_ICONV_UTF = 1]
|
||||
stringeq [test $REPLACE_ICONV_UTF = 1]
|
||||
unistr/u8-mbtoucr [test $REPLACE_ICONV_UTF = 1]
|
||||
unistr/u8-uctomb [test $REPLACE_ICONV_UTF = 1]
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ m4/idcache.m4
|
||||
|
||||
Depends-on:
|
||||
flexmember
|
||||
stringeq
|
||||
xalloc
|
||||
|
||||
configure.ac:
|
||||
|
||||
@@ -9,6 +9,7 @@ m4/localcharset.m4
|
||||
|
||||
Depends-on:
|
||||
extensions
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
gl_LOCALCHARSET
|
||||
|
||||
@@ -11,6 +11,7 @@ locale-h
|
||||
localename-unsafe
|
||||
flexmember
|
||||
lock
|
||||
stringeq
|
||||
bool
|
||||
thread-optim
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ localename-environ
|
||||
extensions
|
||||
locale-h
|
||||
strdup
|
||||
stringeq
|
||||
windows-mutex
|
||||
getlocalename_l-unsafe
|
||||
setlocale-null-unlocked
|
||||
|
||||
@@ -8,6 +8,7 @@ Depends-on:
|
||||
string-h
|
||||
bool
|
||||
str_endswith
|
||||
stringeq
|
||||
mbslen
|
||||
mbiter
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ open
|
||||
unlocked-io-internal
|
||||
bool
|
||||
stdint-h
|
||||
stringeq
|
||||
strstr-simple
|
||||
xalloc
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ m4/newlocale.m4
|
||||
Depends-on:
|
||||
locale-h
|
||||
localename-environ
|
||||
stringeq
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_NEWLOCALE
|
||||
|
||||
@@ -13,6 +13,7 @@ Depends-on:
|
||||
langinfo-h
|
||||
localeconv [test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1]
|
||||
setlocale-null [test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0]
|
||||
stringeq [test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0]
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_NL_LANGINFO
|
||||
|
||||
@@ -10,6 +10,7 @@ Depends-on:
|
||||
c-ctype
|
||||
extensions
|
||||
minmax
|
||||
stringeq
|
||||
unistd-h
|
||||
|
||||
configure.ac:
|
||||
|
||||
@@ -15,6 +15,7 @@ cloexec [test $REPLACE_OPEN = 1]
|
||||
fstat [test $REPLACE_OPEN = 1]
|
||||
lstat [test $REPLACE_OPEN = 1]
|
||||
stat [test $REPLACE_OPEN = 1]
|
||||
stringeq [test $REPLACE_OPEN = 1]
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_OPEN
|
||||
|
||||
@@ -22,6 +22,7 @@ intprops
|
||||
inttypes-h
|
||||
mktime
|
||||
stdckdint-h
|
||||
stringeq
|
||||
time-h
|
||||
time_r
|
||||
time_rz
|
||||
|
||||
@@ -8,6 +8,7 @@ m4/popen.m4
|
||||
Depends-on:
|
||||
stdio-h
|
||||
open [test $HAVE_POPEN = 0 || test $REPLACE_POPEN = 1]
|
||||
stringeq [test $HAVE_POPEN = 0 || test $REPLACE_POPEN = 1]
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_POPEN
|
||||
|
||||
@@ -20,6 +20,7 @@ concat-filename [test $HAVE_POSIX_SPAWN = 0]
|
||||
findprog-in [test $HAVE_POSIX_SPAWN = 0]
|
||||
free-posix [test $HAVE_POSIX_SPAWN = 0]
|
||||
malloca [test $HAVE_POSIX_SPAWN = 0]
|
||||
stringeq [test $HAVE_POSIX_SPAWN = 0]
|
||||
bool [test $HAVE_POSIX_SPAWN = 0]
|
||||
windows-spawn [test $HAVE_POSIX_SPAWN = 0]
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ mbchar
|
||||
mbuiter
|
||||
iconv
|
||||
localcharset
|
||||
stringeq
|
||||
c-strcasecmp
|
||||
xstriconv
|
||||
xalloc
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user