Update from Gnulib by running admin/merge-gnulib

This commit is contained in:
Paul Eggert
2026-01-19 10:40:06 -08:00
parent c0afab671c
commit 4a0919df7f
70 changed files with 179 additions and 183 deletions

View File

@@ -1,7 +1,7 @@
/* Memory allocation on the stack.
Copyright (C) 1995, 1999, 2001-2004, 2006-2026 Free Software
Foundation, Inc.
Copyright (C) 1995, 1999, 2001-2004, 2006-2026 Free Software Foundation,
Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,6 +1,5 @@
/* Binary mode I/O.
Copyright (C) 2001, 2003, 2005, 2008-2026 Free Software Foundation,
Inc.
Copyright (C) 2001, 2003, 2005, 2008-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -5,8 +5,7 @@
<ctype.h> functions' behaviour depends on the current locale set via
setlocale.
Copyright (C) 2000-2003, 2006, 2008-2026 Free Software Foundation,
Inc.
Copyright (C) 2000-2003, 2006, 2008-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,6 +1,5 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 1998-1999, 2005-2006, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,6 +1,5 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 1998-1999, 2005-2006, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,7 @@
/* Read symbolic links into a buffer without size limitation, relative to fd.
Copyright (C) 2001, 2003-2004, 2007, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 2001, 2003-2004, 2007, 2009-2026 Free Software Foundation,
Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,6 @@
/* cloexec.c - set or clear the close-on-exec descriptor flag
Copyright (C) 1991, 2004-2006, 2009-2026 Free Software Foundation,
Inc.
Copyright (C) 1991, 2004-2006, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,6 @@
/* Close a stream, with nicer error checking than fclose's.
Copyright (C) 1998-2002, 2004, 2006-2026 Free Software Foundation,
Inc.
Copyright (C) 1998-2002, 2004, 2006-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
/* Analyze differences between two vectors.
Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2026 Free
Software Foundation, Inc.
Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2026 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,6 @@
/* Duplicate an open file descriptor to a specified file descriptor.
Copyright (C) 1999, 2004-2007, 2009-2026 Free Software Foundation,
Inc.
Copyright (C) 1999, 2004-2007, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,7 @@
/* Make a string describing file modes.
Copyright (C) 1998-1999, 2003, 2006, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 1998-1999, 2003, 2006, 2009-2026 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* fpending.c -- return the number of pending output bytes on a stream
Copyright (C) 2000, 2004, 2006-2007, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 2000, 2004, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
/* Declare __fpending.
Copyright (C) 2000, 2003, 2005-2006, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 2000, 2003, 2005-2006, 2009-2026 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
/* fsusage.c -- return space usage of mounted file systems
Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2026 Free
Software Foundation, Inc.
Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2026 Free Software
Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -92,54 +92,56 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
*lineptr = new_lineptr;
}
size_t cur_len = 0;
for (;;)
{
int i;
{
size_t cur_len = 0;
for (;;)
{
int i;
i = getc_maybe_unlocked (fp);
if (i == EOF)
{
result = -1;
i = getc_maybe_unlocked (fp);
if (i == EOF)
{
result = -1;
break;
}
/* Make enough space for len+1 (for final NUL) bytes. */
if (cur_len + 1 >= *n)
{
size_t needed_max =
SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
size_t needed = 2 * *n + 1; /* Be generous. */
if (needed_max < needed)
needed = needed_max;
if (cur_len + 1 >= needed)
{
result = -1;
errno = EOVERFLOW;
goto unlock_return;
}
char *new_lineptr = (char *) realloc (*lineptr, needed);
if (new_lineptr == NULL)
{
alloc_failed ();
result = -1;
goto unlock_return;
}
*lineptr = new_lineptr;
*n = needed;
}
(*lineptr)[cur_len] = i;
cur_len++;
if (i == delimiter)
break;
}
/* Make enough space for len+1 (for final NUL) bytes. */
if (cur_len + 1 >= *n)
{
size_t needed_max =
SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
size_t needed = 2 * *n + 1; /* Be generous. */
if (needed_max < needed)
needed = needed_max;
if (cur_len + 1 >= needed)
{
result = -1;
errno = EOVERFLOW;
goto unlock_return;
}
char *new_lineptr = (char *) realloc (*lineptr, needed);
if (new_lineptr == NULL)
{
alloc_failed ();
result = -1;
goto unlock_return;
}
*lineptr = new_lineptr;
*n = needed;
}
(*lineptr)[cur_len] = i;
cur_len++;
if (i == delimiter)
break;
}
(*lineptr)[cur_len] = '\0';
result = cur_len ? cur_len : result;
}
(*lineptr)[cur_len] = '\0';
result = cur_len ? cur_len : result;
}
unlock_return:
funlockfile (fp); /* doesn't set errno */

View File

@@ -1,7 +1,6 @@
/* provide consistent interface to getgroups for systems that don't allow N==0
Copyright (C) 1996, 1999, 2003, 2006-2026 Free Software Foundation,
Inc.
Copyright (C) 1996, 1999, 2003, 2006-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,7 @@
/* Get the system load averages.
Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2026 Free
Software Foundation, Inc.
Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2026 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with gnulib.
Bugs can be reported to bug-gnulib@gnu.org.

View File

@@ -1,7 +1,6 @@
/* gettime -- get the system clock
Copyright (C) 2002, 2004-2007, 2009-2026 Free Software Foundation,
Inc.
Copyright (C) 2002, 2004-2007, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,6 @@
/* Provide gettimeofday for systems that don't have it or for which it's broken.
Copyright (C) 2001-2003, 2005-2007, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 2001-2003, 2005-2007, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -951,6 +951,7 @@ HAVE_SYS_ENDIAN_H = @HAVE_SYS_ENDIAN_H@
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
HAVE_SYS_PROCESS_H = @HAVE_SYS_PROCESS_H@
HAVE_SYS_RANDOM_H = @HAVE_SYS_RANDOM_H@
HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@
HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
@@ -3644,6 +3645,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
-e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
-e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
-e 's|@''HAVE_SYS_PROCESS_H''@|$(HAVE_SYS_PROCESS_H)|g' \
-e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
-e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
< $@-t1 > $@-t2

View File

@@ -1,7 +1,7 @@
/* group-member.c -- determine whether group id is in calling user's group list
Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2026 Free
Software Foundation, Inc.
Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2026 Free Software
Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,6 @@
/* malloc() function that is glibc compatible.
Copyright (C) 1997-1998, 2006-2007, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 1997-1998, 2006-2007, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,7 @@
/* Functions to compute MD5 message digest of files or memory blocks.
according to the definition of MD5 in RFC 1321 from April 1992.
Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2026 Free
Software Foundation, Inc.
Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2026 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
This file is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/* Functions to compute MD5 message digest of files or memory blocks.
according to the definition of MD5 in RFC 1321 from April 1992.
Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2026 Free
Software Foundation, Inc.
Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2026 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
This file is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/* Declaration of functions and data types used for MD5 sum computing
library functions.
Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2026 Free
Software Foundation, Inc.
Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2026 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
This file is free software: you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2026 Free
Software Foundation, Inc.
/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2026 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
This file is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,7 @@
/* memrchr -- find the last occurrence of a byte in a memory block
Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2026 Free
Software Foundation, Inc.
Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2026 Free Software
Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
with help from Dan Sahlin (dan@sics.se) and

View File

@@ -1,7 +1,6 @@
/* Provide a replacement for the POSIX nanosleep function.
Copyright (C) 1999-2000, 2002, 2004-2026 Free Software Foundation,
Inc.
Copyright (C) 1999-2000, 2002, 2004-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -405,7 +405,7 @@ get_cgroup2_cpu_quota (void)
if (! fp)
return cpu_quota;
/* Get our cgroupv2 (unififed) hierarchy. */
/* Get our cgroupv2 (unified) hierarchy. */
char *cgroup = NULL;
char *cgroup_str = NULL;
size_t cgroup_size = 0;

View File

@@ -1,7 +1,7 @@
/* Save and restore current working directory.
Copyright (C) 1995, 1997-1998, 2003, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 1995, 1997-1998, 2003, 2009-2026 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,8 +1,7 @@
/* sha1.c - Functions to compute SHA1 message digest of files or
memory blocks according to the NIST specification FIPS-180-1.
Copyright (C) 2000-2001, 2003-2006, 2008-2026 Free Software
Foundation, Inc.
Copyright (C) 2000-2001, 2003-2006, 2008-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,6 @@
/* sig2str.c -- convert between signal names and numbers
Copyright (C) 2002, 2004, 2006, 2009-2026 Free Software Foundation,
Inc.
Copyright (C) 2002, 2004, 2006, 2009-2026 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -47,7 +47,7 @@
These are like the standard macros introduced in C23, except that
arguments should not have side effects. The C++26 standard is
expected to add this header and it's macros. */
expected to add this header and its macros. */
# define ckd_add(r, a, b) ((bool) _GL_INT_ADD_WRAPV (a, b, r))
# define ckd_sub(r, a, b) ((bool) _GL_INT_SUBTRACT_WRAPV (a, b, r))

View File

@@ -1,7 +1,6 @@
/* A GNU-like <stdlib.h>.
Copyright (C) 1995, 2001-2004, 2006-2026 Free Software Foundation,
Inc.
Copyright (C) 1995, 2001-2004, 2006-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -71,6 +70,11 @@
# include <sys/loadavg.h>
#endif
/* QNX declares getprogname() in <sys/process.h>. */
#if (@GNULIB_GETPROGNAME@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_PROCESS_H@
# include <sys/process.h>
#endif
/* Native Windows platforms declare _mktemp() in <io.h>. */
#if defined _WIN32 && !defined __CYGWIN__
# include <io.h>

View File

@@ -316,7 +316,7 @@ typedef sbyte_count_t retval_t;
else if (to_uppcase) \
for (byte_count_t _i = 0; _i < _n; _i++) \
FPUTC (TOUPPER ((UCHAR_T) _s[_i], loc), p); \
else if (fwrite (_s, _n, 1, p) == 0) \
else if (_n && fwrite (_s, _n, 1, p) == 0) \
return FAILURE; \
} \
while (0) \

View File

@@ -1,7 +1,7 @@
/* Convert string representation of a number into an intmax_t value.
Copyright (C) 1999, 2001-2004, 2006, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 1999, 2001-2004, 2006, 2009-2026 Free Software Foundation,
Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View File

@@ -1,7 +1,7 @@
/* Convert string representation of a number into an integer value.
Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2026 Free
Software Foundation, Inc.
Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2026 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@gnu.org.

View File

@@ -1,6 +1,6 @@
/* Function to parse a 'long long int' from text.
Copyright (C) 1995-1997, 1999, 2001, 2009-2026 Free Software
Foundation, Inc.
Copyright (C) 1995-1997, 1999, 2001, 2009-2026 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
This file is free software: you can redistribute it and/or modify

View File

@@ -1,7 +1,6 @@
/* Reentrant time functions like localtime_r.
Copyright (C) 2003, 2006-2007, 2010-2026 Free Software Foundation,
Inc.
Copyright (C) 2003, 2006-2007, 2010-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as