mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Update from Gnulib by running admin/merge-gnulib
This commit is contained in:
parent
cada1c3192
commit
2cc6c81278
27 changed files with 249 additions and 269 deletions
|
|
@ -161,9 +161,7 @@ acl_default_nontrivial (acl_t acl)
|
||||||
int
|
int
|
||||||
acl_nontrivial (int count, aclent_t *entries)
|
acl_nontrivial (int count, aclent_t *entries)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < count; i++)
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
aclent_t *ace = &entries[i];
|
aclent_t *ace = &entries[i];
|
||||||
|
|
||||||
|
|
@ -192,8 +190,6 @@ acl_nontrivial (int count, aclent_t *entries)
|
||||||
int
|
int
|
||||||
acl_ace_nontrivial (int count, ace_t *entries)
|
acl_ace_nontrivial (int count, ace_t *entries)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
/* The flags in the ace_t structure changed in a binary incompatible way
|
/* The flags in the ace_t structure changed in a binary incompatible way
|
||||||
when ACL_NO_TRIVIAL etc. were introduced in <sys/acl.h> version 1.15.
|
when ACL_NO_TRIVIAL etc. were introduced in <sys/acl.h> version 1.15.
|
||||||
How to distinguish the two conventions at runtime?
|
How to distinguish the two conventions at runtime?
|
||||||
|
|
@ -202,7 +198,7 @@ acl_ace_nontrivial (int count, ace_t *entries)
|
||||||
convention, these values are not used. */
|
convention, these values are not used. */
|
||||||
int old_convention = 0;
|
int old_convention = 0;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
|
if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
|
||||||
{
|
{
|
||||||
old_convention = 1;
|
old_convention = 1;
|
||||||
|
|
@ -211,7 +207,7 @@ acl_ace_nontrivial (int count, ace_t *entries)
|
||||||
|
|
||||||
if (old_convention)
|
if (old_convention)
|
||||||
/* Running on Solaris 10. */
|
/* Running on Solaris 10. */
|
||||||
for (i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
ace_t *ace = &entries[i];
|
ace_t *ace = &entries[i];
|
||||||
|
|
||||||
|
|
@ -238,7 +234,7 @@ acl_ace_nontrivial (int count, ace_t *entries)
|
||||||
0 /* everyone@ allow */
|
0 /* everyone@ allow */
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
ace_t *ace = &entries[i];
|
ace_t *ace = &entries[i];
|
||||||
unsigned int index1;
|
unsigned int index1;
|
||||||
|
|
@ -374,12 +370,10 @@ acl_ace_nontrivial (int count, ace_t *entries)
|
||||||
int
|
int
|
||||||
acl_nontrivial (int count, struct acl_entry *entries)
|
acl_nontrivial (int count, struct acl_entry *entries)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (count > 3)
|
if (count > 3)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
struct acl_entry *ace = &entries[i];
|
struct acl_entry *ace = &entries[i];
|
||||||
|
|
||||||
|
|
@ -396,9 +390,7 @@ acl_nontrivial (int count, struct acl_entry *entries)
|
||||||
int
|
int
|
||||||
aclv_nontrivial (int count, struct acl *entries)
|
aclv_nontrivial (int count, struct acl *entries)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < count; i++)
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
struct acl *ace = &entries[i];
|
struct acl *ace = &entries[i];
|
||||||
|
|
||||||
|
|
@ -424,10 +416,8 @@ int
|
||||||
acl_nontrivial (struct acl *a)
|
acl_nontrivial (struct acl *a)
|
||||||
{
|
{
|
||||||
/* The normal way to iterate through an ACL is like this:
|
/* The normal way to iterate through an ACL is like this:
|
||||||
struct acl_entry *ace;
|
for (struct acl_entry *ace = a->acl_ext; ace != acl_last (a); ace = acl_nxt (ace))
|
||||||
for (ace = a->acl_ext; ace != acl_last (a); ace = acl_nxt (ace))
|
|
||||||
{
|
{
|
||||||
struct ace_id *aei;
|
|
||||||
switch (ace->ace_type)
|
switch (ace->ace_type)
|
||||||
{
|
{
|
||||||
case ACC_PERMIT:
|
case ACC_PERMIT:
|
||||||
|
|
@ -435,7 +425,7 @@ acl_nontrivial (struct acl *a)
|
||||||
case ACC_SPECIFY:
|
case ACC_SPECIFY:
|
||||||
...;
|
...;
|
||||||
}
|
}
|
||||||
for (aei = ace->ace_id; aei != id_last (ace); aei = id_nxt (aei))
|
for (struct ace_id *aei = ace->ace_id; aei != id_last (ace); aei = id_nxt (aei))
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
@ -453,9 +443,8 @@ acl_nfs4_nontrivial (nfs4_acl_int_t *a)
|
||||||
return (a->aclEntryN > 0 ? 1 : 0);
|
return (a->aclEntryN > 0 ? 1 : 0);
|
||||||
# else
|
# else
|
||||||
int count = a->aclEntryN;
|
int count = a->aclEntryN;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
nfs4_ace_int_t *ace = &a->aclEntry[i];
|
nfs4_ace_int_t *ace = &a->aclEntry[i];
|
||||||
|
|
||||||
|
|
@ -484,9 +473,7 @@ acl_nfs4_nontrivial (nfs4_acl_int_t *a)
|
||||||
int
|
int
|
||||||
acl_nontrivial (int count, struct acl *entries)
|
acl_nontrivial (int count, struct acl *entries)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < count; i++)
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
struct acl *ace = &entries[i];
|
struct acl *ace = &entries[i];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,9 +286,8 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (find_minimal)
|
if (!find_minimal)
|
||||||
continue;
|
{
|
||||||
|
|
||||||
#ifdef USE_HEURISTIC
|
#ifdef USE_HEURISTIC
|
||||||
bool heuristic = ctxt->heuristic;
|
bool heuristic = ctxt->heuristic;
|
||||||
#else
|
#else
|
||||||
|
|
@ -323,9 +322,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
|
||||||
{
|
{
|
||||||
/* We have a good enough best diagonal; now insist
|
/* We have a good enough best diagonal; now insist
|
||||||
that it end with a significant snake. */
|
that it end with a significant snake. */
|
||||||
int k;
|
for (int k = 1; XREF_YREF_EQUAL (x - k, y - k); k++)
|
||||||
|
|
||||||
for (k = 1; XREF_YREF_EQUAL (x - k, y - k); k++)
|
|
||||||
if (k == SNAKE_LIMIT)
|
if (k == SNAKE_LIMIT)
|
||||||
{
|
{
|
||||||
best = v;
|
best = v;
|
||||||
|
|
@ -362,9 +359,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
|
||||||
{
|
{
|
||||||
/* We have a good enough best diagonal; now insist
|
/* We have a good enough best diagonal; now insist
|
||||||
that it end with a significant snake. */
|
that it end with a significant snake. */
|
||||||
int k;
|
for (int k = 0; XREF_YREF_EQUAL (x + k, y + k); k++)
|
||||||
|
|
||||||
for (k = 0; XREF_YREF_EQUAL (x + k, y + k); k++)
|
|
||||||
if (k == SNAKE_LIMIT - 1)
|
if (k == SNAKE_LIMIT - 1)
|
||||||
{
|
{
|
||||||
best = v;
|
best = v;
|
||||||
|
|
@ -442,6 +437,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#undef XREF_YREF_EQUAL
|
#undef XREF_YREF_EQUAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -146,9 +146,8 @@ dupfd (int oldfd, int newfd, int flags)
|
||||||
/* Close the previous fds that turned out to be too small. */
|
/* Close the previous fds that turned out to be too small. */
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
unsigned int duplicated_fd;
|
|
||||||
|
|
||||||
for (duplicated_fd = 0;
|
for (unsigned int duplicated_fd = 0;
|
||||||
duplicated_fd < fds_to_close_bound * CHAR_BIT;
|
duplicated_fd < fds_to_close_bound * CHAR_BIT;
|
||||||
duplicated_fd++)
|
duplicated_fd++)
|
||||||
if ((fds_to_close[duplicated_fd / CHAR_BIT]
|
if ((fds_to_close[duplicated_fd / CHAR_BIT]
|
||||||
|
|
|
||||||
|
|
@ -495,6 +495,15 @@ _GL_WARN_ON_USE (openat2, "openat2 is not portable - "
|
||||||
# define AT_NO_AUTOMOUNT 0
|
# define AT_NO_AUTOMOUNT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* errno when openat+O_NOFOLLOW fails because the file is a symlink. */
|
||||||
|
#if defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__
|
||||||
|
# define _GL_OPENAT_ESYMLINK EMLINK
|
||||||
|
#elif defined __NetBSD__
|
||||||
|
# define _GL_OPENAT_ESYMLINK EFTYPE
|
||||||
|
#else
|
||||||
|
# define _GL_OPENAT_ESYMLINK ELOOP
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _@GUARD_PREFIX@_FCNTL_H */
|
#endif /* _@GUARD_PREFIX@_FCNTL_H */
|
||||||
#endif /* _@GUARD_PREFIX@_FCNTL_H */
|
#endif /* _@GUARD_PREFIX@_FCNTL_H */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -660,8 +660,8 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd,
|
||||||
(aclent_t *) malloc (alloc * sizeof (aclent_t));
|
(aclent_t *) malloc (alloc * sizeof (aclent_t));
|
||||||
if (entries == NULL)
|
if (entries == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
|
|
@ -732,8 +732,8 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd,
|
||||||
entries = malloced = (ace_t *) malloc (alloc * sizeof (ace_t));
|
entries = malloced = (ace_t *) malloc (alloc * sizeof (ace_t));
|
||||||
if (entries == NULL)
|
if (entries == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,6 @@ FTOASTR (char *buf, size_t bufsize, int flags, int width, FLOAT x)
|
||||||
PROMOTED_FLOAT promoted_x = x;
|
PROMOTED_FLOAT promoted_x = x;
|
||||||
char format[sizeof "%-+ 0*.*Lg"];
|
char format[sizeof "%-+ 0*.*Lg"];
|
||||||
FLOAT abs_x = x < 0 ? -x : x;
|
FLOAT abs_x = x < 0 ? -x : x;
|
||||||
int prec;
|
|
||||||
|
|
||||||
char *p = format;
|
char *p = format;
|
||||||
*p++ = '%';
|
*p++ = '%';
|
||||||
|
|
@ -142,7 +141,7 @@ FTOASTR (char *buf, size_t bufsize, int flags, int width, FLOAT x)
|
||||||
*p++ = flags & FTOASTR_UPPER_E ? 'G' : 'g';
|
*p++ = flags & FTOASTR_UPPER_E ? 'G' : 'g';
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
for (prec = abs_x < FLOAT_MIN ? 1 : FLOAT_DIG; ; prec++)
|
for (int prec = abs_x < FLOAT_MIN ? 1 : FLOAT_DIG; ; prec++)
|
||||||
{
|
{
|
||||||
int n = snprintf (buf, bufsize, format, width, prec, promoted_x);
|
int n = snprintf (buf, bufsize, format, width, prec, promoted_x);
|
||||||
if (n < 0
|
if (n < 0
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,10 @@ getdtablesize (void)
|
||||||
{
|
{
|
||||||
/* We are looking for the number N such that the valid file descriptors
|
/* We are looking for the number N such that the valid file descriptors
|
||||||
are 0..N-1. It can be obtained through a loop as follows:
|
are 0..N-1. It can be obtained through a loop as follows:
|
||||||
{
|
for (int fd = 3; fd < 65536; fd++)
|
||||||
int fd;
|
|
||||||
for (fd = 3; fd < 65536; fd++)
|
|
||||||
if (dup2 (0, fd) == -1)
|
if (dup2 (0, fd) == -1)
|
||||||
break;
|
break;
|
||||||
return fd;
|
return fd;
|
||||||
}
|
|
||||||
On Windows XP, the result is 2048.
|
On Windows XP, the result is 2048.
|
||||||
The drawback of this loop is that it allocates memory for a libc
|
The drawback of this loop is that it allocates memory for a libc
|
||||||
internal array that is never freed.
|
internal array that is never freed.
|
||||||
|
|
|
||||||
|
|
@ -623,11 +623,11 @@ getloadavg (double loadavg[], int nelem)
|
||||||
struct proc_summary proc_sum_data;
|
struct proc_summary proc_sum_data;
|
||||||
struct stat_descr proc_info;
|
struct stat_descr proc_info;
|
||||||
double load;
|
double load;
|
||||||
register unsigned int i, j;
|
register unsigned int j;
|
||||||
|
|
||||||
if (cpus == 0)
|
if (cpus == 0)
|
||||||
{
|
{
|
||||||
register unsigned int c, i;
|
register unsigned int c;
|
||||||
struct cpu_config conf;
|
struct cpu_config conf;
|
||||||
struct stat_descr desc;
|
struct stat_descr desc;
|
||||||
|
|
||||||
|
|
@ -641,7 +641,7 @@ getloadavg (double loadavg[], int nelem)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
for (i = 0; i < conf.config_maxclass; ++i)
|
for (unsigned int i = 0; i < conf.config_maxclass; ++i)
|
||||||
{
|
{
|
||||||
struct class_stats stats;
|
struct class_stats stats;
|
||||||
memset (&stats, 0, sizeof stats);
|
memset (&stats, 0, sizeof stats);
|
||||||
|
|
@ -672,7 +672,7 @@ getloadavg (double loadavg[], int nelem)
|
||||||
|
|
||||||
load = proc_sum_data.ps_nrunnable;
|
load = proc_sum_data.ps_nrunnable;
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = samples - 1; i > 0; --i)
|
for (unsigned int i = samples - 1; i > 0; --i)
|
||||||
{
|
{
|
||||||
load += proc_sum_data.ps_nrun[j];
|
load += proc_sum_data.ps_nrun[j];
|
||||||
if (j++ == PS_NRUNSIZE)
|
if (j++ == PS_NRUNSIZE)
|
||||||
|
|
|
||||||
|
|
@ -73,14 +73,13 @@ get_group_info (struct group_info *gi)
|
||||||
int
|
int
|
||||||
group_member (gid_t gid)
|
group_member (gid_t gid)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int found;
|
int found;
|
||||||
struct group_info gi;
|
struct group_info gi;
|
||||||
int n_groups = get_group_info (&gi);
|
int n_groups = get_group_info (&gi);
|
||||||
|
|
||||||
/* Search through the list looking for GID. */
|
/* Search through the list looking for GID. */
|
||||||
found = 0;
|
found = 0;
|
||||||
for (i = 0; i < n_groups; i++)
|
for (int i = 0; i < n_groups; i++)
|
||||||
{
|
{
|
||||||
if (gid == gi.group[i])
|
if (gid == gi.group[i])
|
||||||
{
|
{
|
||||||
|
|
@ -99,9 +98,7 @@ group_member (gid_t gid)
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 1; i < argc; i++)
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
{
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */
|
/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */
|
||||||
#if defined __clang_major__ && __clang_major__ < 14
|
#if defined __clang_major__ && __clang_major__ < 21
|
||||||
/* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>. */
|
/* Work around Clang bug <https://github.com/llvm/llvm-project/issues/16778>. */
|
||||||
# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0
|
# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0
|
||||||
#else
|
#else
|
||||||
# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW
|
# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW
|
||||||
|
|
@ -179,9 +179,9 @@
|
||||||
_GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
|
_GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See:
|
/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25764. See:
|
||||||
https://gcc.gnu.org/PR68193
|
https://gcc.gnu.org/PR68193
|
||||||
https://llvm.org/bugs/show_bug.cgi?id=25390
|
https://github.com/llvm/llvm-project/issues/25764
|
||||||
For now, assume GCC < 14 and all Clang versions generate bogus
|
For now, assume GCC < 14 and all Clang versions generate bogus
|
||||||
warnings for _Generic. This matters only for compilers that
|
warnings for _Generic. This matters only for compilers that
|
||||||
lack relevant builtins. */
|
lack relevant builtins. */
|
||||||
|
|
|
||||||
|
|
@ -84,16 +84,12 @@ __memrchr (void const *s, int c_in, size_t n)
|
||||||
repeated_one |= repeated_one << 31 << 1;
|
repeated_one |= repeated_one << 31 << 1;
|
||||||
repeated_c |= repeated_c << 31 << 1;
|
repeated_c |= repeated_c << 31 << 1;
|
||||||
if (8 < sizeof (longword))
|
if (8 < sizeof (longword))
|
||||||
{
|
for (size_t i = 64; i < sizeof (longword) * 8; i *= 2)
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 64; i < sizeof (longword) * 8; i *= 2)
|
|
||||||
{
|
{
|
||||||
repeated_one |= repeated_one << i;
|
repeated_one |= repeated_one << i;
|
||||||
repeated_c |= repeated_c << i;
|
repeated_c |= repeated_c << i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Instead of the traditional loop which tests each byte, we will test a
|
/* Instead of the traditional loop which tests each byte, we will test a
|
||||||
longword at a time. The tricky part is testing if *any of the four*
|
longword at a time. The tricky part is testing if *any of the four*
|
||||||
|
|
|
||||||
|
|
@ -468,11 +468,9 @@ __mktime_internal (struct tm *tp, bool local, mktime_offset_t *offset)
|
||||||
int year_seconds_bound = 366 * 24 * 60 * 60 + 1;
|
int year_seconds_bound = 366 * 24 * 60 * 60 + 1;
|
||||||
int delta_bound = year_seconds_bound + stride;
|
int delta_bound = year_seconds_bound + stride;
|
||||||
|
|
||||||
int delta, direction;
|
|
||||||
|
|
||||||
/* Search in both directions, closest first. */
|
/* Search in both directions, closest first. */
|
||||||
for (delta = stride; delta < delta_bound; delta += stride)
|
for (int delta = stride; delta < delta_bound; delta += stride)
|
||||||
for (direction = -1; direction <= 1; direction += 2)
|
for (int direction = -1; direction <= 1; direction += 2)
|
||||||
{
|
{
|
||||||
long_int ot;
|
long_int ot;
|
||||||
if (! ckd_add (&ot, t, delta * direction))
|
if (! ckd_add (&ot, t, delta * direction))
|
||||||
|
|
|
||||||
16
lib/nproc.c
16
lib/nproc.c
|
|
@ -89,10 +89,8 @@ num_processors_via_affinity_mask (void)
|
||||||
/* glibc >= 2.6 has the CPU_COUNT macro. */
|
/* glibc >= 2.6 has the CPU_COUNT macro. */
|
||||||
count = CPU_COUNT (&set);
|
count = CPU_COUNT (&set);
|
||||||
# else
|
# else
|
||||||
size_t i;
|
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < CPU_SETSIZE; i++)
|
for (size_t i = 0; i < CPU_SETSIZE; i++)
|
||||||
if (CPU_ISSET (i, &set))
|
if (CPU_ISSET (i, &set))
|
||||||
count++;
|
count++;
|
||||||
# endif
|
# endif
|
||||||
|
|
@ -112,9 +110,7 @@ num_processors_via_affinity_mask (void)
|
||||||
if (pthread_getaffinity_np (pthread_self (), cpuset_size (set), set)
|
if (pthread_getaffinity_np (pthread_self (), cpuset_size (set), set)
|
||||||
== 0)
|
== 0)
|
||||||
{
|
{
|
||||||
cpuid_t i;
|
for (cpuid_t i = 0;; i++)
|
||||||
|
|
||||||
for (i = 0;; i++)
|
|
||||||
{
|
{
|
||||||
int ret = cpuset_isset (i, set);
|
int ret = cpuset_isset (i, set);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
@ -180,10 +176,8 @@ num_processors_via_affinity_mask (void)
|
||||||
/* glibc >= 2.6 has the CPU_COUNT macro. */
|
/* glibc >= 2.6 has the CPU_COUNT macro. */
|
||||||
count = CPU_COUNT (&set);
|
count = CPU_COUNT (&set);
|
||||||
# else
|
# else
|
||||||
size_t i;
|
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < CPU_SETSIZE; i++)
|
for (size_t i = 0; i < CPU_SETSIZE; i++)
|
||||||
if (CPU_ISSET (i, &set))
|
if (CPU_ISSET (i, &set))
|
||||||
count++;
|
count++;
|
||||||
# endif
|
# endif
|
||||||
|
|
@ -202,9 +196,7 @@ num_processors_via_affinity_mask (void)
|
||||||
|
|
||||||
if (sched_getaffinity_np (getpid (), cpuset_size (set), set) == 0)
|
if (sched_getaffinity_np (getpid (), cpuset_size (set), set) == 0)
|
||||||
{
|
{
|
||||||
cpuid_t i;
|
for (cpuid_t i = 0;; i++)
|
||||||
|
|
||||||
for (i = 0;; i++)
|
|
||||||
{
|
{
|
||||||
int ret = cpuset_isset (i, set);
|
int ret = cpuset_isset (i, set);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
|
||||||
|
|
@ -95,15 +95,13 @@ rpl_pselect (int nfds, fd_set *restrict rfds,
|
||||||
struct timespec const *restrict timeout,
|
struct timespec const *restrict timeout,
|
||||||
sigset_t const *restrict sigmask)
|
sigset_t const *restrict sigmask)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
/* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */
|
/* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */
|
||||||
if (nfds < 0 || nfds > FD_SETSIZE)
|
if (nfds < 0 || nfds > FD_SETSIZE)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i = 0; i < nfds; i++)
|
for (int i = 0; i < nfds; i++)
|
||||||
{
|
{
|
||||||
if (((rfds && FD_ISSET (i, rfds))
|
if (((rfds && FD_ISSET (i, rfds))
|
||||||
|| (wfds && FD_ISSET (i, wfds))
|
|| (wfds && FD_ISSET (i, wfds))
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,8 @@ set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,10 +108,8 @@ set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod)
|
||||||
convention = -1;
|
convention = -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
convention = 0;
|
convention = 0;
|
||||||
for (i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
|
if (entries[i].a_flags & (OLD_ACE_OWNER | OLD_ACE_GROUP | OLD_ACE_OTHER))
|
||||||
{
|
{
|
||||||
convention = 1;
|
convention = 1;
|
||||||
|
|
|
||||||
|
|
@ -254,8 +254,7 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
|
||||||
while (words < endp)
|
while (words < endp)
|
||||||
{
|
{
|
||||||
uint32_t tm;
|
uint32_t tm;
|
||||||
int t;
|
for (int t = 0; t < 16; t++)
|
||||||
for (t = 0; t < 16; t++)
|
|
||||||
{
|
{
|
||||||
x[t] = SWAP (*words);
|
x[t] = SWAP (*words);
|
||||||
words++;
|
words++;
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,9 @@ set_uint32 (char *cp, uint32_t v)
|
||||||
void *
|
void *
|
||||||
sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
|
sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char *r = resbuf;
|
char *r = resbuf;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
||||||
|
|
||||||
return resbuf;
|
return resbuf;
|
||||||
|
|
@ -108,10 +107,9 @@ sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
|
||||||
void *
|
void *
|
||||||
sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
|
sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char *r = resbuf;
|
char *r = resbuf;
|
||||||
|
|
||||||
for (i = 0; i < 7; i++)
|
for (int i = 0; i < 7; i++)
|
||||||
set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
set_uint32 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
||||||
|
|
||||||
return resbuf;
|
return resbuf;
|
||||||
|
|
@ -338,9 +336,8 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
|
||||||
{
|
{
|
||||||
uint32_t tm;
|
uint32_t tm;
|
||||||
uint32_t t0, t1;
|
uint32_t t0, t1;
|
||||||
int t;
|
|
||||||
/* FIXME: see sha1.c for a better implementation. */
|
/* FIXME: see sha1.c for a better implementation. */
|
||||||
for (t = 0; t < 16; t++)
|
for (int t = 0; t < 16; t++)
|
||||||
{
|
{
|
||||||
x[t] = SWAP (*words);
|
x[t] = SWAP (*words);
|
||||||
words++;
|
words++;
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,9 @@ set_uint64 (char *cp, u64 v)
|
||||||
void *
|
void *
|
||||||
sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
|
sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char *r = resbuf;
|
char *r = resbuf;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
||||||
|
|
||||||
return resbuf;
|
return resbuf;
|
||||||
|
|
@ -108,10 +107,9 @@ sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
|
||||||
void *
|
void *
|
||||||
sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
|
sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char *r = resbuf;
|
char *r = resbuf;
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
set_uint64 (r + i * sizeof ctx->state[0], SWAP (ctx->state[i]));
|
||||||
|
|
||||||
return resbuf;
|
return resbuf;
|
||||||
|
|
@ -367,9 +365,8 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
|
||||||
|
|
||||||
while (words < endp)
|
while (words < endp)
|
||||||
{
|
{
|
||||||
int t;
|
|
||||||
/* FIXME: see sha1.c for a better implementation. */
|
/* FIXME: see sha1.c for a better implementation. */
|
||||||
for (t = 0; t < 16; t++)
|
for (int t = 0; t < 16; t++)
|
||||||
{
|
{
|
||||||
x[t] = SWAP (*words);
|
x[t] = SWAP (*words);
|
||||||
words++;
|
words++;
|
||||||
|
|
|
||||||
|
|
@ -286,8 +286,7 @@ str2signum (char const *signame)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int i;
|
for (unsigned int i = 0; i < NUMNAME_ENTRIES; i++)
|
||||||
for (i = 0; i < NUMNAME_ENTRIES; i++)
|
|
||||||
if (streq (numname_table[i].name, signame))
|
if (streq (numname_table[i].name, signame))
|
||||||
return numname_table[i].num;
|
return numname_table[i].num;
|
||||||
|
|
||||||
|
|
@ -331,8 +330,7 @@ str2sig (char const *signame, int *signum)
|
||||||
int
|
int
|
||||||
sig2str (int signum, char *signame)
|
sig2str (int signum, char *signame)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
for (unsigned int i = 0; i < NUMNAME_ENTRIES; i++)
|
||||||
for (i = 0; i < NUMNAME_ENTRIES; i++)
|
|
||||||
if (numname_table[i].num == signum)
|
if (numname_table[i].num == signum)
|
||||||
{
|
{
|
||||||
strcpy (signame, numname_table[i].name);
|
strcpy (signame, numname_table[i].name);
|
||||||
|
|
|
||||||
|
|
@ -232,8 +232,7 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st)
|
||||||
short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim),
|
short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim),
|
||||||
STAT_TIMESPEC_OFFSETOF (st_mtim),
|
STAT_TIMESPEC_OFFSETOF (st_mtim),
|
||||||
STAT_TIMESPEC_OFFSETOF (st_ctim) };
|
STAT_TIMESPEC_OFFSETOF (st_ctim) };
|
||||||
int i;
|
for (int i = 0; i < sizeof ts_off / sizeof *ts_off; i++)
|
||||||
for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++)
|
|
||||||
{
|
{
|
||||||
struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]);
|
struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]);
|
||||||
long int q = ts->tv_nsec / timespec_hz;
|
long int q = ts->tv_nsec / timespec_hz;
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,6 @@ static RETURN_TYPE _GL_ATTRIBUTE_PURE
|
||||||
two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
|
two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
|
||||||
const unsigned char *needle, size_t needle_len)
|
const unsigned char *needle, size_t needle_len)
|
||||||
{
|
{
|
||||||
size_t i; /* Index into current byte of NEEDLE. */
|
|
||||||
size_t j; /* Index into current window of HAYSTACK. */
|
size_t j; /* Index into current window of HAYSTACK. */
|
||||||
size_t period; /* The period of the right half of needle. */
|
size_t period; /* The period of the right half of needle. */
|
||||||
size_t suffix; /* The index of the right half of needle. */
|
size_t suffix; /* The index of the right half of needle. */
|
||||||
|
|
@ -344,9 +343,9 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
|
||||||
shift_table[c] is the distance from the last occurrence of c to
|
shift_table[c] is the distance from the last occurrence of c to
|
||||||
the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
|
the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
|
||||||
shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */
|
shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */
|
||||||
for (i = 0; i < 1U << CHAR_BIT; i++)
|
for (size_t i = 0; i < 1U << CHAR_BIT; i++)
|
||||||
shift_table[i] = needle_len;
|
shift_table[i] = needle_len;
|
||||||
for (i = 0; i < needle_len; i++)
|
for (size_t i = 0; i < needle_len; i++)
|
||||||
shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
|
shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
|
||||||
|
|
||||||
/* Perform the search. Each iteration compares the right half
|
/* Perform the search. Each iteration compares the right half
|
||||||
|
|
@ -379,7 +378,7 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
|
||||||
}
|
}
|
||||||
/* Scan for matches in right half. The last byte has
|
/* Scan for matches in right half. The last byte has
|
||||||
already been matched, by virtue of the shift table. */
|
already been matched, by virtue of the shift table. */
|
||||||
i = MAX (suffix, memory);
|
size_t i = MAX (suffix, memory);
|
||||||
while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
|
while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
|
||||||
== CANON_ELEMENT (haystack[i + j])))
|
== CANON_ELEMENT (haystack[i + j])))
|
||||||
++i;
|
++i;
|
||||||
|
|
@ -423,7 +422,7 @@ two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
|
||||||
}
|
}
|
||||||
/* Scan for matches in right half. The last byte has
|
/* Scan for matches in right half. The last byte has
|
||||||
already been matched, by virtue of the shift table. */
|
already been matched, by virtue of the shift table. */
|
||||||
i = suffix;
|
size_t i = suffix;
|
||||||
while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
|
while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
|
||||||
== CANON_ELEMENT (haystack[i + j])))
|
== CANON_ELEMENT (haystack[i + j])))
|
||||||
++i;
|
++i;
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,9 @@ enum pad_style
|
||||||
#if SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME
|
#if SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME
|
||||||
/* Support for non-Gregorian calendars. */
|
/* Support for non-Gregorian calendars. */
|
||||||
# include "localcharset.h"
|
# include "localcharset.h"
|
||||||
|
# if !(defined __APPLE__ && defined __MACH__)
|
||||||
# include "localename.h"
|
# include "localename.h"
|
||||||
|
# endif
|
||||||
# include "calendars.h"
|
# include "calendars.h"
|
||||||
# define CAL_ARGS(x,y) x, y,
|
# define CAL_ARGS(x,y) x, y,
|
||||||
#else
|
#else
|
||||||
|
|
@ -1020,8 +1022,7 @@ underlying_strftime (timezone_t tz, char *ubuf, size_t ubufsize,
|
||||||
{
|
{
|
||||||
/* The last word has length >= 3. */
|
/* The last word has length >= 3. */
|
||||||
bool found_letter = false;
|
bool found_letter = false;
|
||||||
const char *p;
|
for (const char *p = space + 1; *p != '\0'; p++)
|
||||||
for (p = space + 1; *p != '\0'; p++)
|
|
||||||
if ((*p >= 'A' && *p <= 'Z')
|
if ((*p >= 'A' && *p <= 'Z')
|
||||||
|| (*p >= 'a' && *p <= 'z'))
|
|| (*p >= 'a' && *p <= 'z'))
|
||||||
{
|
{
|
||||||
|
|
@ -1138,9 +1139,9 @@ my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
#if SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME
|
#if SUPPORT_NON_GREG_CALENDARS_IN_STRFTIME
|
||||||
/* Recognize whether to use a non-Gregorian calendar. */
|
/* Recognize whether to use a non-Gregorian calendar. */
|
||||||
const struct calendar *cal = NULL;
|
const struct calendar *cal = NULL;
|
||||||
struct calendar_date caldate;
|
|
||||||
if (strcmp (locale_charset (), "UTF-8") == 0)
|
if (strcmp (locale_charset (), "UTF-8") == 0)
|
||||||
{
|
{
|
||||||
|
# if !(defined __APPLE__ && defined __MACH__)
|
||||||
const char *loc = gl_locale_name_unsafe (LC_TIME, "LC_TIME");
|
const char *loc = gl_locale_name_unsafe (LC_TIME, "LC_TIME");
|
||||||
if (strlen (loc) >= 5 && !(loc[5] >= 'A' && loc[5] <= 'Z'))
|
if (strlen (loc) >= 5 && !(loc[5] >= 'A' && loc[5] <= 'Z'))
|
||||||
{
|
{
|
||||||
|
|
@ -1150,6 +1151,38 @@ my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
cal = &persian_calendar;
|
cal = &persian_calendar;
|
||||||
else if (memcmp (loc, "am_ET", 5) == 0)
|
else if (memcmp (loc, "am_ET", 5) == 0)
|
||||||
cal = ðiopian_calendar;
|
cal = ðiopian_calendar;
|
||||||
|
}
|
||||||
|
# else /* defined __APPLE__ && defined __MACH__ */
|
||||||
|
/* Nearly equivalent code for macOS, that avoids the need to link with
|
||||||
|
CoreFoundation.
|
||||||
|
It's not entirely equivalent, because it tests only for the language
|
||||||
|
(Thai, Farsi, Amharic) instead of also for the territory (Thailand,
|
||||||
|
Iran, Ethiopia). */
|
||||||
|
/* Get the translation of "Monday" in the LC_TIME locale, by calling
|
||||||
|
the underlying strftime function. */
|
||||||
|
struct tm some_monday; /* 2024-01-01 12:00:00 */
|
||||||
|
memset (&some_monday, '\0', sizeof (struct tm));
|
||||||
|
some_monday.tm_year = 2024 - 1900;
|
||||||
|
some_monday.tm_mon = 1 - 1;
|
||||||
|
some_monday.tm_mday = 1;
|
||||||
|
some_monday.tm_wday = 1; /* Monday */
|
||||||
|
some_monday.tm_hour = 12;
|
||||||
|
some_monday.tm_min = 0;
|
||||||
|
some_monday.tm_sec = 0;
|
||||||
|
char weekday_buf[32];
|
||||||
|
if (strftime (weekday_buf, sizeof (weekday_buf), "%A", &some_monday) > 0)
|
||||||
|
{
|
||||||
|
/* Test for the Thai / Farsi / Amharic translation of "Monday". */
|
||||||
|
if (streq (weekday_buf, "จันทร์") || streq (weekday_buf, "วันจันทร์"))
|
||||||
|
cal = &thai_calendar;
|
||||||
|
else if (streq (weekday_buf, "ﺩﻮﺸﻨﺒﻫ") || streq (weekday_buf, "دوشنبه"))
|
||||||
|
cal = &persian_calendar;
|
||||||
|
else if (streq (weekday_buf, "ሰኞ"))
|
||||||
|
cal = ðiopian_calendar;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
struct calendar_date caldate;
|
||||||
if (cal != NULL)
|
if (cal != NULL)
|
||||||
{
|
{
|
||||||
if (cal->from_gregorian (&caldate,
|
if (cal->from_gregorian (&caldate,
|
||||||
|
|
@ -1158,8 +1191,6 @@ my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
tp->tm_mday) < 0)
|
tp->tm_mday) < 0)
|
||||||
cal = NULL;
|
cal = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
bool tzset_called = false;
|
bool tzset_called = false;
|
||||||
return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp,
|
return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp,
|
||||||
|
|
@ -1248,7 +1279,6 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
#endif
|
#endif
|
||||||
retval_t i = 0;
|
retval_t i = 0;
|
||||||
STREAM_OR_CHAR_T *p = s;
|
STREAM_OR_CHAR_T *p = s;
|
||||||
const CHAR_T *f;
|
|
||||||
#if DO_MULTIBYTE && !defined COMPILE_WIDE
|
#if DO_MULTIBYTE && !defined COMPILE_WIDE
|
||||||
const char *format_end = NULL;
|
const char *format_end = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1260,7 +1290,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
if (hour12 == 0)
|
if (hour12 == 0)
|
||||||
hour12 = 12;
|
hour12 = 12;
|
||||||
|
|
||||||
for (f = format; *f != '\0'; width = -1, f++)
|
for (const CHAR_T *f = format; *f != '\0'; width = -1, f++)
|
||||||
{
|
{
|
||||||
enum pad_style pad = ZERO_PAD;
|
enum pad_style pad = ZERO_PAD;
|
||||||
int modifier; /* Field modifier ('E', 'O', or 0). */
|
int modifier; /* Field modifier ('E', 'O', or 0). */
|
||||||
|
|
@ -1659,10 +1689,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
|
||||||
{
|
{
|
||||||
/* The last word has length >= 3. */
|
/* The last word has length >= 3. */
|
||||||
bool found_letter = false;
|
bool found_letter = false;
|
||||||
const char *p;
|
for (const char *wp = space + 1; *wp != '\0'; wp++)
|
||||||
for (p = space + 1; *p != '\0'; p++)
|
if ((*wp >= 'A' && *wp <= 'Z')
|
||||||
if ((*p >= 'A' && *p <= 'Z')
|
|| (*wp >= 'a' && *wp <= 'z'))
|
||||||
|| (*p >= 'a' && *p <= 'z'))
|
|
||||||
{
|
{
|
||||||
found_letter = true;
|
found_letter = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,7 @@ strnlen (const char *s, size_t maxlen)
|
||||||
{
|
{
|
||||||
/* Do not use memchr, because on some platforms memchr has
|
/* Do not use memchr, because on some platforms memchr has
|
||||||
undefined behavior if MAXLEN exceeds the number of bytes in S. */
|
undefined behavior if MAXLEN exceeds the number of bytes in S. */
|
||||||
size_t i;
|
for (size_t i = 0; i < maxlen && s[i]; i++)
|
||||||
for (i = 0; i < maxlen && s[i]; i++)
|
|
||||||
continue;
|
continue;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,6 @@ INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
|
||||||
register unsigned int cutlim;
|
register unsigned int cutlim;
|
||||||
register unsigned LONG int i;
|
register unsigned LONG int i;
|
||||||
register const STRING_TYPE *s;
|
register const STRING_TYPE *s;
|
||||||
register UCHAR_TYPE c;
|
|
||||||
const STRING_TYPE *save, *end;
|
const STRING_TYPE *save, *end;
|
||||||
int overflow;
|
int overflow;
|
||||||
|
|
||||||
|
|
@ -307,7 +306,7 @@ INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
|
||||||
{
|
{
|
||||||
/* Find the end of the digit string and check its grouping. */
|
/* Find the end of the digit string and check its grouping. */
|
||||||
end = s;
|
end = s;
|
||||||
for (c = *end; c != L_('\0'); c = *++end)
|
for (UCHAR_TYPE c = *end; c != L_('\0'); c = *++end)
|
||||||
if ((wchar_t) c != thousands
|
if ((wchar_t) c != thousands
|
||||||
&& ((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))
|
&& ((wchar_t) c < L_('0') || (wchar_t) c > L_('9'))
|
||||||
&& (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base))
|
&& (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base))
|
||||||
|
|
@ -326,7 +325,7 @@ INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
|
||||||
|
|
||||||
overflow = 0;
|
overflow = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
for (c = *s; c != L_('\0'); c = *++s)
|
for (UCHAR_TYPE c = *s; c != L_('\0'); c = *++s)
|
||||||
{
|
{
|
||||||
if (s == end)
|
if (s == end)
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -152,11 +152,10 @@ typedef int suseconds_t;
|
||||||
static int
|
static int
|
||||||
rpl_fd_isset (SOCKET fd, const fd_set * set)
|
rpl_fd_isset (SOCKET fd, const fd_set * set)
|
||||||
{
|
{
|
||||||
u_int i;
|
|
||||||
if (set == NULL)
|
if (set == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < set->fd_count; i++)
|
for (u_int i = 0; i < set->fd_count; i++)
|
||||||
if (set->fd_array[i] == fd)
|
if (set->fd_array[i] == fd)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,6 @@ try_tempname_len (char *tmpl, int suffixlen, void *args,
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *XXXXXX;
|
char *XXXXXX;
|
||||||
unsigned int count;
|
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
|
||||||
|
|
@ -236,7 +235,7 @@ try_tempname_len (char *tmpl, int suffixlen, void *args,
|
||||||
/* This is where the Xs start. */
|
/* This is where the Xs start. */
|
||||||
XXXXXX = &tmpl[len - x_suffix_len - suffixlen];
|
XXXXXX = &tmpl[len - x_suffix_len - suffixlen];
|
||||||
|
|
||||||
for (count = 0; count < attempts; ++count)
|
for (unsigned int count = 0; count < attempts; ++count)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < x_suffix_len; i++)
|
for (size_t i = 0; i < x_suffix_len; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# gnulib-common.m4
|
# gnulib-common.m4
|
||||||
# serial 113
|
# serial 114
|
||||||
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
|
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
|
||||||
dnl This file is free software; the Free Software Foundation
|
dnl This file is free software; the Free Software Foundation
|
||||||
dnl gives unlimited permission to copy and/or distribute it,
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
|
|
@ -1406,7 +1406,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
|
||||||
dnl -Wno-type-limits >= 4.3 >= 3.9
|
dnl -Wno-type-limits >= 4.3 >= 3.9
|
||||||
dnl -Wno-undef >= 3 >= 3.9
|
dnl -Wno-undef >= 3 >= 3.9
|
||||||
dnl -Wno-unsuffixed-float-constants >= 4.5
|
dnl -Wno-unsuffixed-float-constants >= 4.5
|
||||||
dnl -Wno-unused-const-variable >= 4.4 >= 3.9
|
dnl -Wno-unused-const-variable >= 6.1 >= 3.9
|
||||||
dnl -Wno-unused-function >= 3 >= 3.9
|
dnl -Wno-unused-function >= 3 >= 3.9
|
||||||
dnl -Wno-unused-parameter >= 3 >= 3.9
|
dnl -Wno-unused-parameter >= 3 >= 3.9
|
||||||
dnl
|
dnl
|
||||||
|
|
@ -1436,7 +1436,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
|
||||||
-Wno-sign-conversion
|
-Wno-sign-conversion
|
||||||
-Wno-type-limits
|
-Wno-type-limits
|
||||||
#endif
|
#endif
|
||||||
#if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
|
#if (__GNUC__ + (__GNUC_MINOR__ >= 1) > 6 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
|
||||||
-Wno-unused-const-variable
|
-Wno-unused-const-variable
|
||||||
#endif
|
#endif
|
||||||
#if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
|
#if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue