Update from Gnulib

Make the following changes by hand, and run 'admin/merge-gnulib'.
* .gitignore: Add lib/malloc/*.gl.h.
* admin/merge-gnulib: Copy lib/af_alg.h and lib/save-cwd.h
directly from Gnulib, without worrying about Gnulib modules,
as these files are special cases.
(AVOIDED_MODULES): Remove malloc-posix.
* lib/malloc.c, lib/realloc.c, m4/malloc.m4, m4/realloc.m4:
* m4/year2038.m4: New files, copied from Gnulib.
* lib/malloca.c, lib/malloca.h:
* m4/close-stream.m4, m4/glibc21.m4, m4/malloca.m4:
Remove.  These are either no longer present in Gnulib, or are no
longer needed by modules that Emacs uses.
* oldXMenu/AddPane.c, oldXmenu/Addsel.c: Include XmenuInt.h first;
needed for new Gnulib.
* src/xmenu.c: Call emacs_abort, not abort.
This commit is contained in:
Paul Eggert 2021-10-04 12:11:39 -07:00
parent 63cb65dcce
commit 68a256c892
236 changed files with 5795 additions and 4157 deletions

1
.gitignore vendored
View file

@ -65,6 +65,7 @@ lib/ieee754.h
lib/inttypes.h lib/inttypes.h
lib/libgnu.a lib/libgnu.a
lib/limits.h lib/limits.h
lib/malloc/*.gl.h
lib/signal.h lib/signal.h
lib/std*.h lib/std*.h
!lib/std*.in.h !lib/std*.in.h

View file

@ -322,8 +322,11 @@ Use --without-toolkit-scroll-bars to disable Motif or Xaw3d scroll bars.
Use --without-xim to inhibit the default use of X Input Methods. Use --without-xim to inhibit the default use of X Input Methods.
In this case, the X resource useXIM can be used to turn on use of XIM. In this case, the X resource useXIM can be used to turn on use of XIM.
Use --disable-largefile to omit support for files larger than 2GB on Use --disable-largefile to omit support for files larger than 2GB, and
systems which support that. --disable-year2038 to omit support for timestamps past the year 2038,
on systems which allow omitting such support. This may help when
linking Emacs to a library with an ABI that requires a particular
width for off_t or for time_t.
Use --without-sound to disable sound support. Use --without-sound to disable sound support.

View file

@ -50,7 +50,7 @@ GNULIB_MODULES='
AVOIDED_MODULES=' AVOIDED_MODULES='
btowc close dup fchdir fstat langinfo lock btowc close dup fchdir fstat langinfo lock
malloc-posix mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo
openat-die opendir pthread-h raise openat-die opendir pthread-h raise
save-cwd select setenv sigprocmask stat stdarg stdbool save-cwd select setenv sigprocmask stat stdarg stdbool
threadlib tzset unsetenv utime utime-h threadlib tzset unsetenv utime utime-h
@ -118,5 +118,8 @@ cp -- "$gnulib_srcdir"/build-aux/config.guess \
"$gnulib_srcdir"/build-aux/install-sh \ "$gnulib_srcdir"/build-aux/install-sh \
"$gnulib_srcdir"/build-aux/move-if-change \ "$gnulib_srcdir"/build-aux/move-if-change \
"$src"build-aux && "$src"build-aux &&
cp -- "$gnulib_srcdir"/lib/af_alg.h \
"$gnulib_srcdir"/lib/save-cwd.h \
"$src"lib &&
{ test -z "$src" || cd "$src"; } && { test -z "$src" || cd "$src"; } &&
./autogen.sh ./autogen.sh

1229
build-aux/config.guess vendored

File diff suppressed because it is too large Load diff

87
build-aux/config.sub vendored
View file

@ -2,7 +2,9 @@
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright 1992-2021 Free Software Foundation, Inc. # Copyright 1992-2021 Free Software Foundation, Inc.
timestamp='2021-01-07' # shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2021-08-14'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -50,7 +52,14 @@ timestamp='2021-01-07'
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification. # It is wrong to echo any other type of specification.
me=$(echo "$0" | sed -e 's,.*/,,') # The "shellcheck disable" line above the timestamp inhibits complaints
# about features and limitations of the classic Bourne shell that were
# superseded or lifted in POSIX. However, this script identifies a wide
# variety of pre-POSIX systems that do not have POSIX shells at all, and
# even some reasonably current systems (Solaris 10 as case-in-point) still
# have a pre-POSIX /bin/sh.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\ usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
@ -112,9 +121,11 @@ esac
# Split fields of configuration type # Split fields of configuration type
# shellcheck disable=SC2162 # shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read field1 field2 field3 field4 <<EOF IFS="-" read field1 field2 field3 field4 <<EOF
$1 $1
EOF EOF
IFS=$saved_IFS
# Separate into logical components for further validation # Separate into logical components for further validation
case $1 in case $1 in
@ -163,6 +174,10 @@ case $1 in
basic_machine=$field1 basic_machine=$field1
basic_os=$field2 basic_os=$field2
;; ;;
zephyr*)
basic_machine=$field1-unknown
basic_os=$field2
;;
# Manufacturers # Manufacturers
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
@ -769,22 +784,22 @@ case $basic_machine in
vendor=hp vendor=hp
;; ;;
i*86v32) i*86v32)
cpu=$(echo "$1" | sed -e 's/86.*/86/') cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc vendor=pc
basic_os=sysv32 basic_os=sysv32
;; ;;
i*86v4*) i*86v4*)
cpu=$(echo "$1" | sed -e 's/86.*/86/') cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc vendor=pc
basic_os=sysv4 basic_os=sysv4
;; ;;
i*86v) i*86v)
cpu=$(echo "$1" | sed -e 's/86.*/86/') cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc vendor=pc
basic_os=sysv basic_os=sysv
;; ;;
i*86sol2) i*86sol2)
cpu=$(echo "$1" | sed -e 's/86.*/86/') cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc vendor=pc
basic_os=solaris2 basic_os=solaris2
;; ;;
@ -917,14 +932,16 @@ case $basic_machine in
;; ;;
leon-*|leon[3-9]-*) leon-*|leon[3-9]-*)
cpu=sparc cpu=sparc
vendor=$(echo "$basic_machine" | sed 's/-.*//') vendor=`echo "$basic_machine" | sed 's/-.*//'`
;; ;;
*-*) *-*)
# shellcheck disable=SC2162 # shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read cpu vendor <<EOF IFS="-" read cpu vendor <<EOF
$basic_machine $basic_machine
EOF EOF
IFS=$saved_IFS
;; ;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
@ -1084,7 +1101,7 @@ case $cpu-$vendor in
cpu=mipsisa64sb1el cpu=mipsisa64sb1el
;; ;;
sh5e[lb]-*) sh5e[lb]-*)
cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/') cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
;; ;;
spur-*) spur-*)
cpu=spur cpu=spur
@ -1102,7 +1119,7 @@ case $cpu-$vendor in
cpu=x86_64 cpu=x86_64
;; ;;
xscale-* | xscalee[bl]-*) xscale-* | xscalee[bl]-*)
cpu=$(echo "$cpu" | sed 's/^xscale/arm/') cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;; ;;
arm64-*) arm64-*)
cpu=aarch64 cpu=aarch64
@ -1165,7 +1182,7 @@ case $cpu-$vendor in
| alphapca5[67] | alpha64pca5[67] \ | alphapca5[67] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| amdgcn \ | amdgcn \
| arc | arceb \ | arc | arceb | arc32 | arc64 \
| arm | arm[lb]e | arme[lb] | armv* \ | arm | arm[lb]e | arme[lb] | armv* \
| avr | avr32 \ | avr | avr32 \
| asmjs \ | asmjs \
@ -1204,9 +1221,13 @@ case $cpu-$vendor in
| mips64vr5900 | mips64vr5900el \ | mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \ | mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \ | mipsisa32r2 | mipsisa32r2el \
| mipsisa32r3 | mipsisa32r3el \
| mipsisa32r5 | mipsisa32r5el \
| mipsisa32r6 | mipsisa32r6el \ | mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \ | mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64r3 | mipsisa64r3el \
| mipsisa64r5 | mipsisa64r5el \
| mipsisa64r6 | mipsisa64r6el \ | mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
@ -1288,30 +1309,32 @@ then
case $basic_os in case $basic_os in
gnu/linux*) gnu/linux*)
kernel=linux kernel=linux
os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
;; ;;
os2-emx) os2-emx)
kernel=os2 kernel=os2
os=$(echo $basic_os | sed -e 's|os2-emx|emx|') os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
;; ;;
nto-qnx*) nto-qnx*)
kernel=nto kernel=nto
os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
;; ;;
*-*) *-*)
# shellcheck disable=SC2162 # shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read kernel os <<EOF IFS="-" read kernel os <<EOF
$basic_os $basic_os
EOF EOF
IFS=$saved_IFS
;; ;;
# Default OS when just kernel was specified # Default OS when just kernel was specified
nto*) nto*)
kernel=nto kernel=nto
os=$(echo $basic_os | sed -e 's|nto|qnx|') os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
;; ;;
linux*) linux*)
kernel=linux kernel=linux
os=$(echo $basic_os | sed -e 's|linux|gnu|') os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
;; ;;
*) *)
kernel= kernel=
@ -1332,7 +1355,7 @@ case $os in
os=cnk os=cnk
;; ;;
solaris1 | solaris1.*) solaris1 | solaris1.*)
os=$(echo $os | sed -e 's|solaris1|sunos4|') os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
;; ;;
solaris) solaris)
os=solaris2 os=solaris2
@ -1361,7 +1384,7 @@ case $os in
os=sco3.2v4 os=sco3.2v4
;; ;;
sco3.2.[4-9]*) sco3.2.[4-9]*)
os=$(echo $os | sed -e 's/sco3.2./sco3.2v/') os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
;; ;;
sco*v* | scout) sco*v* | scout)
# Don't match below # Don't match below
@ -1391,7 +1414,7 @@ case $os in
os=lynxos os=lynxos
;; ;;
mac[0-9]*) mac[0-9]*)
os=$(echo "$os" | sed -e 's|mac|macos|') os=`echo "$os" | sed -e 's|mac|macos|'`
;; ;;
opened*) opened*)
os=openedition os=openedition
@ -1400,10 +1423,10 @@ case $os in
os=os400 os=os400
;; ;;
sunos5*) sunos5*)
os=$(echo "$os" | sed -e 's|sunos5|solaris2|') os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
;; ;;
sunos6*) sunos6*)
os=$(echo "$os" | sed -e 's|sunos6|solaris3|') os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
;; ;;
wince*) wince*)
os=wince os=wince
@ -1437,7 +1460,7 @@ case $os in
;; ;;
# Preserve the version number of sinix5. # Preserve the version number of sinix5.
sinix5.*) sinix5.*)
os=$(echo $os | sed -e 's|sinix|sysv|') os=`echo "$os" | sed -e 's|sinix|sysv|'`
;; ;;
sinix*) sinix*)
os=sysv4 os=sysv4
@ -1683,12 +1706,15 @@ fi
# Now, validate our (potentially fixed-up) OS. # Now, validate our (potentially fixed-up) OS.
case $os in case $os in
# Sometimes we do "kernel-abi", so those need to count as OSes. # Sometimes we do "kernel-libc", so those need to count as OSes.
musl* | newlib* | uclibc*) musl* | newlib* | relibc* | uclibc*)
;; ;;
# Likewise for "kernel-libc" # Likewise for "kernel-abi"
eabi* | gnueabi*) eabi* | gnueabi*)
;; ;;
# VxWorks passes extra cpu info in the 4th filed.
simlinux | simwindows | spe)
;;
# Now accept the basic system types. # Now accept the basic system types.
# The portable systems comes first. # The portable systems comes first.
# Each alternative MUST end in a * to match a version number. # Each alternative MUST end in a * to match a version number.
@ -1704,12 +1730,12 @@ case $os in
| nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
| clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
| mirbsd* | netbsd* | dicos* | openedition* | ose* \ | mirbsd* | netbsd* | dicos* | openedition* | ose* \
| bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
| ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
| bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
| ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
| udi* | lites* | ieee* | go32* | aux* | hcos* \ | udi* | lites* | ieee* | go32* | aux* | hcos* \
| chorusrdb* | cegcc* | glidix* \ | chorusrdb* | cegcc* | glidix* | serenity* \
| cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
| midipix* | mingw32* | mingw64* | mint* \ | midipix* | mingw32* | mingw64* | mint* \
| uxpv* | beos* | mpeix* | udk* | moxiebox* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \
@ -1722,7 +1748,7 @@ case $os in
| skyos* | haiku* | rdos* | toppers* | drops* | es* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
;; ;;
# This one is extra strict with allowed versions # This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*) sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@ -1739,11 +1765,12 @@ esac
# As a final step for OS-related things, validate the OS-kernel combination # As a final step for OS-related things, validate the OS-kernel combination
# (given a valid OS), if there is a kernel. # (given a valid OS), if there is a kernel.
case $kernel-$os in case $kernel-$os in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
| linux-musl* | linux-relibc* | linux-uclibc* )
;; ;;
uclinux-uclibc* ) uclinux-uclibc* )
;; ;;
-dietlibc* | -newlib* | -musl* | -uclibc* ) -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
# These are just libc implementations, not actual OSes, and thus # These are just libc implementations, not actual OSes, and thus
# require a kernel. # require a kernel.
echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
@ -1751,6 +1778,8 @@ case $kernel-$os in
;; ;;
kfreebsd*-gnu* | kopensolaris*-gnu*) kfreebsd*-gnu* | kopensolaris*-gnu*)
;; ;;
vxworks-simlinux | vxworks-simwindows | vxworks-spe)
;;
nto-qnx*) nto-qnx*)
;; ;;
os2-emx) os2-emx)

View file

@ -35,7 +35,7 @@
eval 'exec perl -wSx "$0" "$@"' eval 'exec perl -wSx "$0" "$@"'
if 0; if 0;
my $VERSION = '2020-04-04 15:07'; # UTC my $VERSION = '2021-02-24 23:42'; # UTC
# The definition above must lie within the first 8 lines in order # The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it. # for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook # If you change this file with Emacs, please let the write hook
@ -455,7 +455,8 @@ sub git_dir_option($)
# If there were any lines # If there were any lines
if (@line == 0) if (@line == 0)
{ {
warn "$ME: warning: empty commit message:\n $date_line\n"; warn "$ME: warning: empty commit message:\n"
. " commit $sha\n $date_line\n";
} }
else else
{ {

View file

@ -3,9 +3,9 @@
% Load plain if necessary, i.e., if running under initex. % Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
% %
\def\texinfoversion{2020-11-25.18} \def\texinfoversion{2021-04-25.21}
% %
% Copyright 1985, 1986, 1988, 1990-2020 Free Software Foundation, Inc. % Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc.
% %
% This texinfo.tex file is free software: you can redistribute it and/or % This texinfo.tex file is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as % modify it under the terms of the GNU General Public License as
@ -574,7 +574,7 @@
% @end foo calls \checkenv and executes the definition of \Efoo. % @end foo calls \checkenv and executes the definition of \Efoo.
\parseargdef\end{ \parseargdef\end{%
\if 1\csname iscond.#1\endcsname \if 1\csname iscond.#1\endcsname
\else \else
% The general wording of \badenverr may not be ideal. % The general wording of \badenverr may not be ideal.
@ -1002,6 +1002,14 @@
\global\everypar = {}% \global\everypar = {}%
} }
% leave vertical mode without cancelling any first paragraph indent
\gdef\imageindent{%
\toks0=\everypar
\everypar={}%
\ptexnoindent
\global\everypar=\toks0
}
% @refill is a no-op. % @refill is a no-op.
\let\refill=\relax \let\refill=\relax
@ -1181,7 +1189,7 @@
% double any backslashes. Otherwise, a name like "\node" will be % double any backslashes. Otherwise, a name like "\node" will be
% interpreted as a newline (\n), followed by o, d, e. Not good. % interpreted as a newline (\n), followed by o, d, e. Not good.
% %
% See https://mailman.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
% related messages. The final outcome is that it is up to the TeX user % related messages. The final outcome is that it is up to the TeX user
% to double the backslashes and otherwise make the string valid, so % to double the backslashes and otherwise make the string valid, so
% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
@ -1862,19 +1870,23 @@
\closein 1 \closein 1
\endgroup \endgroup
% %
\def\xetexpdfext{pdf}% % Putting an \hbox around the image can prevent an over-long line
\ifx\xeteximgext\xetexpdfext % after the image.
\XeTeXpdffile "#1".\xeteximgext "" \hbox\bgroup
\else \def\xetexpdfext{pdf}%
\def\xetexpdfext{PDF}%
\ifx\xeteximgext\xetexpdfext \ifx\xeteximgext\xetexpdfext
\XeTeXpdffile "#1".\xeteximgext "" \XeTeXpdffile "#1".\xeteximgext ""
\else \else
\XeTeXpicfile "#1".\xeteximgext "" \def\xetexpdfext{PDF}%
\ifx\xeteximgext\xetexpdfext
\XeTeXpdffile "#1".\xeteximgext ""
\else
\XeTeXpicfile "#1".\xeteximgext ""
\fi
\fi \fi
\fi \ifdim \wd0 >0pt width \xeteximagewidth \fi
\ifdim \wd0 >0pt width \xeteximagewidth \fi \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
\ifdim \wd2 >0pt height \xeteximageheight \fi \relax \egroup
} }
\fi \fi
@ -3539,7 +3551,7 @@
% We use the free feym* fonts from the eurosym package by Henrik % We use the free feym* fonts from the eurosym package by Henrik
% Theiling, which support regular, slanted, bold and bold slanted (and % Theiling, which support regular, slanted, bold and bold slanted (and
% "outlined" (blackboard board, sort of) versions, which we don't need). % "outlined" (blackboard board, sort of) versions, which we don't need).
% It is available from https://www.ctan.org/tex-archive/fonts/eurosym. % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
% %
% Although only regular is the truly official Euro symbol, we ignore % Although only regular is the truly official Euro symbol, we ignore
% that. The Euro is designed to be slightly taller than the regular % that. The Euro is designed to be slightly taller than the regular
@ -4289,82 +4301,8 @@
\doitemize{#1.}\flushcr \doitemize{#1.}\flushcr
} }
% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
% to @enumerate.
%
\def\alphaenumerate{\enumerate{a}}
\def\capsenumerate{\enumerate{A}}
\def\Ealphaenumerate{\Eenumerate}
\def\Ecapsenumerate{\Eenumerate}
% @multitable macros % @multitable macros
% Amy Hendrickson, 8/18/94, 3/6/96
%
% @multitable ... @end multitable will make as many columns as desired.
% Contents of each column will wrap at width given in preamble. Width
% can be specified either with sample text given in a template line,
% or in percent of \hsize, the current width of text on page.
% Table can continue over pages but will only break between lines.
% To make preamble:
%
% Either define widths of columns in terms of percent of \hsize:
% @multitable @columnfractions .25 .3 .45
% @item ...
%
% Numbers following @columnfractions are the percent of the total
% current hsize to be used for each column. You may use as many
% columns as desired.
% Or use a template:
% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
% @item ...
% using the widest term desired in each column.
% Each new table line starts with @item, each subsequent new column
% starts with @tab. Empty columns may be produced by supplying @tab's
% with nothing between them for as many times as empty columns are needed,
% ie, @tab@tab@tab will produce two empty columns.
% @item, @tab do not need to be on their own lines, but it will not hurt
% if they are.
% Sample multitable:
% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
% @item first col stuff @tab second col stuff @tab third col
% @item
% first col stuff
% @tab
% second col stuff
% @tab
% third col
% @item first col stuff @tab second col stuff
% @tab Many paragraphs of text may be used in any column.
%
% They will wrap at the width determined by the template.
% @item@tab@tab This will be in third column.
% @end multitable
% Default dimensions may be reset by user.
% @multitableparskip is vertical space between paragraphs in table.
% @multitableparindent is paragraph indent in table.
% @multitablecolmargin is horizontal space to be left between columns.
% @multitablelinespace is space to leave between table items, baseline
% to baseline.
% 0pt means it depends on current normal line spacing.
%
\newskip\multitableparskip
\newskip\multitableparindent
\newdimen\multitablecolspace
\newskip\multitablelinespace
\multitableparskip=0pt
\multitableparindent=6pt
\multitablecolspace=12pt
\multitablelinespace=0pt
% Macros used to set up halign preamble: % Macros used to set up halign preamble:
% %
@ -4412,8 +4350,6 @@
\go \go
} }
% multitable-only commands.
%
% @headitem starts a heading row, which we typeset in bold. Assignments % @headitem starts a heading row, which we typeset in bold. Assignments
% have to be global since we are inside the implicit group of an % have to be global since we are inside the implicit group of an
% alignment entry. \everycr below resets \everytab so we don't have to % alignment entry. \everycr below resets \everytab so we don't have to
@ -4430,14 +4366,8 @@
% default for tables with no headings. % default for tables with no headings.
\let\headitemcrhook=\relax \let\headitemcrhook=\relax
% %
% A \tab used to include \hskip1sp. But then the space in a template
% line is not enough. That is bad. So let's go back to just `&' until
% we again encounter the problem the 1sp was intended to solve.
% --karl, nathan@acm.org, 20apr99.
\def\tab{\checkenv\multitable &\the\everytab}% \def\tab{\checkenv\multitable &\the\everytab}%
% @multitable ... @end multitable definitions:
%
\newtoks\everytab % insert after every tab. \newtoks\everytab % insert after every tab.
% %
\envdef\multitable{% \envdef\multitable{%
@ -4452,9 +4382,8 @@
% %
\tolerance=9500 \tolerance=9500
\hbadness=9500 \hbadness=9500
\setmultitablespacing \parskip=0pt
\parskip=\multitableparskip \parindent=6pt
\parindent=\multitableparindent
\overfullrule=0pt \overfullrule=0pt
\global\colcount=0 \global\colcount=0
% %
@ -4484,47 +4413,24 @@
% continue for many paragraphs if desired. % continue for many paragraphs if desired.
\halign\bgroup &% \halign\bgroup &%
\global\advance\colcount by 1 \global\advance\colcount by 1
\multistrut \strut
\vtop{% \vtop{%
% Use the current \colcount to find the correct column width: \advance\hsize by -1\leftskip
% Find the correct column width
\hsize=\expandafter\csname col\the\colcount\endcsname \hsize=\expandafter\csname col\the\colcount\endcsname
% %
% In order to keep entries from bumping into each other
% we will add a \leftskip of \multitablecolspace to all columns after
% the first one.
%
% If a template has been used, we will add \multitablecolspace
% to the width of each template entry.
%
% If the user has set preamble in terms of percent of \hsize we will
% use that dimension as the width of the column, and the \leftskip
% will keep entries from bumping into each other. Table will start at
% left margin and final column will justify at right margin.
%
% Make sure we don't inherit \rightskip from the outer environment.
\rightskip=0pt \rightskip=0pt
\ifnum\colcount=1 \ifnum\colcount=1
% The first column will be indented with the surrounding text. \advance\hsize by\leftskip % Add indent of surrounding text
\advance\hsize by\leftskip
\else \else
\ifsetpercent \else % In order to keep entries from bumping into each other.
% If user has not set preamble in terms of percent of \hsize \leftskip=12pt
% we will advance \hsize by \multitablecolspace. \ifsetpercent \else
\advance\hsize by \multitablecolspace % If a template has been used
\fi \advance\hsize by \leftskip
% In either case we will make \leftskip=\multitablecolspace: \fi
\leftskip=\multitablecolspace
\fi \fi
% Ignoring space at the beginning and end avoids an occasional spurious \noindent\ignorespaces##\unskip\strut
% blank line, when TeX decides to break the line at the space before the
% box from the multistrut, so the strut ends up on a line by itself.
% For example:
% @multitable @columnfractions .11 .89
% @item @code{#}
% @tab Legal holiday which is valid in major parts of the whole country.
% Is automatically provided with highlighting sequences respectively
% marking characters.
\noindent\ignorespaces##\unskip\multistrut
}\cr }\cr
} }
\def\Emultitable{% \def\Emultitable{%
@ -4533,31 +4439,6 @@
\global\setpercentfalse \global\setpercentfalse
} }
\def\setmultitablespacing{%
\def\multistrut{\strut}% just use the standard line spacing
%
% Compute \multitablelinespace (if not defined by user) for use in
% \multitableparskip calculation. We used define \multistrut based on
% this, but (ironically) that caused the spacing to be off.
% See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
\ifdim\multitablelinespace=0pt
\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
\global\advance\multitablelinespace by-\ht0
\fi
% Test to see if parskip is larger than space between lines of
% table. If not, do nothing.
% If so, set to same dimension as multitablelinespace.
\ifdim\multitableparskip>\multitablelinespace
\global\multitableparskip=\multitablelinespace
\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
% than skip between lines in the table.
\fi%
\ifdim\multitableparskip=0pt
\global\multitableparskip=\multitablelinespace
\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
% than skip between lines in the table.
\fi}
\message{conditionals,} \message{conditionals,}
@ -5171,30 +5052,29 @@
\let\lbracechar\{% \let\lbracechar\{%
\let\rbracechar\}% \let\rbracechar\}%
% %
% Non-English letters.
\def\AA{AA}%
\def\AE{AE}%
\def\DH{DZZ}%
\def\L{L}%
\def\OE{OE}%
\def\O{O}%
\def\TH{TH}%
\def\aa{aa}%
\def\ae{ae}%
\def\dh{dzz}%
\def\exclamdown{!}%
\def\l{l}%
\def\oe{oe}%
\def\ordf{a}%
\def\ordm{o}%
\def\o{o}%
\def\questiondown{?}%
\def\ss{ss}%
\def\th{th}%
% %
\let\do\indexnofontsdef \let\do\indexnofontsdef
% %
% Non-English letters.
\do\AA{AA}%
\do\AE{AE}%
\do\DH{DZZ}%
\do\L{L}%
\do\OE{OE}%
\do\O{O}%
\do\TH{TH}%
\do\aa{aa}%
\do\ae{ae}%
\do\dh{dzz}%
\do\exclamdown{!}%
\do\l{l}%
\do\oe{oe}%
\do\ordf{a}%
\do\ordm{o}%
\do\o{o}%
\do\questiondown{?}%
\do\ss{ss}%
\do\th{th}%
%
\do\LaTeX{LaTeX}% \do\LaTeX{LaTeX}%
\do\TeX{TeX}% \do\TeX{TeX}%
% %
@ -8931,7 +8811,7 @@
\else \else
\ifhavexrefs \ifhavexrefs
% We (should) know the real title if we have the xref values. % We (should) know the real title if we have the xref values.
\def\printedrefname{\refx{#1-title}{}}% \def\printedrefname{\refx{#1-title}}%
\else \else
% Otherwise just copy the Info node name. % Otherwise just copy the Info node name.
\def\printedrefname{\ignorespaces #1}% \def\printedrefname{\ignorespaces #1}%
@ -9025,7 +8905,7 @@
% If the user specified the print name (third arg) to the ref, % If the user specified the print name (third arg) to the ref,
% print it instead of our usual "Figure 1.2". % print it instead of our usual "Figure 1.2".
\ifdim\wd\printedrefnamebox = 0pt \ifdim\wd\printedrefnamebox = 0pt
\refx{#1-snt}{}% \refx{#1-snt}%
\else \else
\printedrefname \printedrefname
\fi \fi
@ -9060,9 +8940,9 @@
\else \else
% Reference within this manual. % Reference within this manual.
% %
% Only output a following space if the -snt ref is nonempty; for % Only output a following space if the -snt ref is nonempty, as the ref
% @unnumbered and @anchor, it won't be. % will be empty for @unnumbered and @anchor.
\setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
\ifdim \wd2 > 0pt \refx{#1-snt}\space\fi \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
% %
% output the `[mynode]' via the macro below so it can be overridden. % output the `[mynode]' via the macro below so it can be overridden.
@ -9073,7 +8953,7 @@
,\space ,\space
% %
% output the `page 3'. % output the `page 3'.
\turnoffactive \putwordpage\tie\refx{#1-pg}{}% \turnoffactive \putwordpage\tie\refx{#1-pg}%
% Add a , if xref followed by a space % Add a , if xref followed by a space
\if\space\noexpand\tokenafterxref ,% \if\space\noexpand\tokenafterxref ,%
\else\ifx\ \tokenafterxref ,% @TAB \else\ifx\ \tokenafterxref ,% @TAB
@ -9150,9 +9030,8 @@
\fi\fi\fi \fi\fi\fi
} }
% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX % \refx{NAME} - reference a cross-reference string named NAME.
% is output afterwards if non-empty. \def\refx#1{%
\def\refx#1#2{%
\requireauxfile \requireauxfile
{% {%
\indexnofonts \indexnofonts
@ -9179,7 +9058,6 @@
% It's defined, so just use it. % It's defined, so just use it.
\thisrefX \thisrefX
\fi \fi
#2% Output the suffix in any case.
} }
% This is the macro invoked by entries in the aux file. Define a control % This is the macro invoked by entries in the aux file. Define a control
@ -9289,10 +9167,10 @@
\catcode`\[=\other \catcode`\[=\other
\catcode`\]=\other \catcode`\]=\other
\catcode`\"=\other \catcode`\"=\other
\catcode`\_=\other \catcode`\_=\active
\catcode`\|=\other \catcode`\|=\active
\catcode`\<=\other \catcode`\<=\active
\catcode`\>=\other \catcode`\>=\active
\catcode`\$=\other \catcode`\$=\other
\catcode`\#=\other \catcode`\#=\other
\catcode`\&=\other \catcode`\&=\other
@ -9539,7 +9417,7 @@
% On the other hand, if we are in the case of @center @image, we don't % On the other hand, if we are in the case of @center @image, we don't
% want to start a paragraph, which will create a hsize-width box and % want to start a paragraph, which will create a hsize-width box and
% eradicate the centering. % eradicate the centering.
\ifx\centersub\centerV\else \noindent \fi \ifx\centersub\centerV \else \imageindent \fi
% %
% Output the image. % Output the image.
\ifpdf \ifpdf
@ -11731,3 +11609,4 @@
@c vim:sw=2: @c vim:sw=2:
@enablebackslashhack @enablebackslashhack

View file

@ -79,6 +79,14 @@ at build time.
This was only ever relevant when building from a repository checkout. This was only ever relevant when building from a repository checkout.
This now requires makeinfo, which is part of the texinfo package. This now requires makeinfo, which is part of the texinfo package.
---
** There is a new configure option '--disable-year2038' to cause
Emacs to use only 32-bit time_t on platforms that have both 32- and
64-bit time_t. This may help link Emacs to a library with ABI
requiring traditional 32-bit time_t. This option currently affects
only 32-bit ARM and x86 running GNU/Linux with glibc 2.34 and later.
Emacs now defaults to 64-bit time_t on these platforms.
--- ---
** Support for building with '-fcheck-pointer-bounds' has been removed. ** Support for building with '-fcheck-pointer-bounds' has been removed.
GCC has withdrawn the '-fcheck-pointer-bounds' option and support for GCC has withdrawn the '-fcheck-pointer-bounds' option and support for

View file

@ -2,16 +2,16 @@
Copyright (C) 2011-2021 Free Software Foundation, Inc. Copyright (C) 2011-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _Noreturn #ifndef _Noreturn
@ -29,7 +29,7 @@
# elif ((!defined __cplusplus || defined __clang__) \ # elif ((!defined __cplusplus || defined __clang__) \
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| (!defined __STRICT_ANSI__ \ || (!defined __STRICT_ANSI__ \
&& (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ && (4 < __GNUC__ + (7 <= __GNUC_MINOR__) \
|| (defined __apple_build_version__ \ || (defined __apple_build_version__ \
? 6000000 <= __apple_build_version__ \ ? 6000000 <= __apple_build_version__ \
: 3 < __clang_major__ + (5 <= __clang_minor__)))))) : 3 < __clang_major__ + (5 <= __clang_minor__))))))

View file

@ -1,18 +1,18 @@
/* af_alg.h - Compute message digests from file streams and buffers. /* af_alg.h - Compute message digests from file streams and buffers.
Copyright (C) 2018-2020 Free Software Foundation, Inc. Copyright (C) 2018-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it This file is free software: you can redistribute it and/or modify
under the terms of the GNU General Public License as published by the it under the terms of the GNU Lesser General Public License as
Free Software Foundation; either version 2, or (at your option) any published by the Free Software Foundation; either version 2.1 of the
later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Matteo Croce <mcroce@redhat.com>, 2018. /* Written by Matteo Croce <mcroce@redhat.com>, 2018.
Documentation by Bruno Haible <bruno@clisp.org>, 2018. */ Documentation by Bruno Haible <bruno@clisp.org>, 2018. */

View file

@ -3,20 +3,18 @@
Copyright (C) 1995, 1999, 2001-2004, 2006-2021 Free Software Foundation, Copyright (C) 1995, 1999, 2001-2004, 2006-2021 Free Software Foundation,
Inc. Inc.
This program is free software; you can redistribute it and/or modify it This file is free software: you can redistribute it and/or modify
under the terms of the GNU General Public License as published it under the terms of the GNU Lesser General Public License as
by the Free Software Foundation; either version 3, or (at your option) published by the Free Software Foundation; either version 2.1 of the
any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public License
License along with this program; if not, see along with this program. If not, see <https://www.gnu.org/licenses/>. */
<https://www.gnu.org/licenses/>.
*/
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
means there is a real alloca function. */ means there is a real alloca function. */

View file

@ -1,3 +1,20 @@
/* Memory allocators such as malloc+free.
Copyright (C) 2011-2021 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
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#define _GL_USE_STDLIB_ALLOC 1 #define _GL_USE_STDLIB_ALLOC 1
#include <config.h> #include <config.h>
#include "allocator.h" #include "allocator.h"

View file

@ -2,17 +2,17 @@
Copyright (C) 2011-2021 Free Software Foundation, Inc. Copyright (C) 2011-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */ /* Written by Paul Eggert. */

View file

@ -2,16 +2,16 @@
Copyright (C) 2009-2021 Free Software Foundation, Inc. Copyright (C) 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools

View file

@ -2,17 +2,17 @@
Copyright 2020-2021 Free Software Foundation, Inc. Copyright 2020-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it This file is free software: you can redistribute it and/or modify
under the terms of the GNU General Public License as published it under the terms of the GNU Lesser General Public License as
by the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */ /* Written by Paul Eggert. */
@ -32,7 +32,7 @@
/* This file defines two types of attributes: /* This file defines two types of attributes:
* C2X standard attributes. These have macro names that do not begin with * C2x standard attributes. These have macro names that do not begin with
'ATTRIBUTE_'. 'ATTRIBUTE_'.
* Selected GCC attributes; see: * Selected GCC attributes; see:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
@ -76,6 +76,14 @@
/* Applies to: function, pointer to function, function types. */ /* Applies to: function, pointer to function, function types. */
#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args) #define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args)
/* ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
that can be freed by passing them as the Ith argument to the
function F.
ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
can be freed via 'free'; it can be used only after declaring 'free'. */
/* Applies to: functions. Cannot be used on inline functions. */
#define ATTRIBUTE_DEALLOC(f, i) _GL_ATTRIBUTE_DEALLOC(f, i)
#define ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC_FREE
/* Attributes for variadic functions. */ /* Attributes for variadic functions. */

View file

@ -1,17 +1,17 @@
/* Binary mode I/O. /* Binary mode I/O.
Copyright 2017-2021 Free Software Foundation, Inc. Copyright 2017-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>

View file

@ -1,17 +1,17 @@
/* Binary mode I/O. /* Binary mode I/O.
Copyright (C) 2001, 2003, 2005, 2008-2021 Free Software Foundation, Inc. Copyright (C) 2001, 2003, 2005, 2008-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _BINARY_H #ifndef _BINARY_H
@ -47,7 +47,7 @@ _GL_INLINE_HEADER_BEGIN
/* Use a function rather than a macro, to avoid gcc warnings /* Use a function rather than a macro, to avoid gcc warnings
"warning: statement with no effect". */ "warning: statement with no effect". */
BINARY_IO_INLINE int BINARY_IO_INLINE int
__gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED) __gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode)
{ {
return O_BINARY; return O_BINARY;
} }

View file

@ -2,17 +2,17 @@
Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc.
Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005. Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GL_BYTESWAP_H #ifndef _GL_BYTESWAP_H

View file

@ -2,16 +2,16 @@
Copyright (C) 2010-2021 Free Software Foundation, Inc. Copyright (C) 2010-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GL_CXXDEFS_H #ifndef _GL_CXXDEFS_H

View file

@ -1,3 +1,21 @@
/* Character handling in C locale.
Copyright (C) 2003-2021 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
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#define C_CTYPE_INLINE _GL_EXTERN_INLINE #define C_CTYPE_INLINE _GL_EXTERN_INLINE
#include "c-ctype.h" #include "c-ctype.h"

View file

@ -7,18 +7,18 @@
Copyright (C) 2000-2003, 2006, 2008-2021 Free Software Foundation, Inc. Copyright (C) 2000-2003, 2006, 2008-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef C_CTYPE_H #ifndef C_CTYPE_H
#define C_CTYPE_H #define C_CTYPE_H

View file

@ -2,18 +2,18 @@
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2021 Free Software Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2021 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software; you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3, or (at your option) published by the Free Software Foundation; either version 2.1 of the
any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef C_STRCASE_H #ifndef C_STRCASE_H
#define C_STRCASE_H #define C_STRCASE_H

View file

@ -1,18 +1,18 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale /* c-strcasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc. Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3, or (at your option) published by the Free Software Foundation; either version 2.1 of the
any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>

View file

@ -1,18 +1,18 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale /* c-strncasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc. Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3, or (at your option) published by the Free Software Foundation; either version 2.1 of the
any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
@ -21,7 +21,6 @@
optimizes away the name == NULL test below. */ optimizes away the name == NULL test below. */
# define _GL_ARG_NONNULL(params) # define _GL_ARG_NONNULL(params)
# define _GL_USE_STDLIB_ALLOC 1
# include <libc-config.h> # include <libc-config.h>
#endif #endif
@ -75,7 +74,12 @@
# define __pathconf pathconf # define __pathconf pathconf
# define __rawmemchr rawmemchr # define __rawmemchr rawmemchr
# define __readlink readlink # define __readlink readlink
# define __stat stat # if IN_RELOCWRAPPER
/* When building the relocatable program wrapper, use the system's memmove
function, not the gnulib override, otherwise we would get a link error.
*/
# undef memmove
# endif
#endif #endif
/* Suppress bogus GCC -Wmaybe-uninitialized warnings. */ /* Suppress bogus GCC -Wmaybe-uninitialized warnings. */
@ -100,7 +104,7 @@ file_accessible (char const *file)
return __faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0; return __faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0;
# else # else
struct stat st; struct stat st;
return __stat (file, &st) == 0 || errno == EOVERFLOW; return stat (file, &st) == 0 || errno == EOVERFLOW;
# endif # endif
} }

View file

@ -3,17 +3,17 @@
Copyright (C) 2001, 2003-2004, 2007, 2009-2021 Free Software Foundation, Copyright (C) 2001, 2003-2004, 2007, 2009-2021 Free Software Foundation,
Inc. Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
@ -22,6 +22,9 @@
#include "careadlinkat.h" #include "careadlinkat.h"
#include "idx.h"
#include "minmax.h"
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
@ -65,11 +68,6 @@ readlink_stk (int fd, char const *filename,
ssize_t (*preadlinkat) (int, char const *, char *, size_t), ssize_t (*preadlinkat) (int, char const *, char *, size_t),
char stack_buf[STACK_BUF_SIZE]) char stack_buf[STACK_BUF_SIZE])
{ {
char *buf;
size_t buf_size;
size_t buf_size_max =
SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
if (! alloc) if (! alloc)
alloc = &stdlib_allocator; alloc = &stdlib_allocator;
@ -79,14 +77,14 @@ readlink_stk (int fd, char const *filename,
buffer_size = STACK_BUF_SIZE; buffer_size = STACK_BUF_SIZE;
} }
buf = buffer; char *buf = buffer;
buf_size = buffer_size; idx_t buf_size_max = MIN (IDX_MAX, MIN (SSIZE_MAX, SIZE_MAX));
idx_t buf_size = MIN (buffer_size, buf_size_max);
while (buf) while (buf)
{ {
/* Attempt to read the link into the current buffer. */ /* Attempt to read the link into the current buffer. */
ssize_t link_length = preadlinkat (fd, filename, buf, buf_size); idx_t link_length = preadlinkat (fd, filename, buf, buf_size);
size_t link_size;
if (link_length < 0) if (link_length < 0)
{ {
if (buf != buffer) if (buf != buffer)
@ -98,7 +96,7 @@ readlink_stk (int fd, char const *filename,
return NULL; return NULL;
} }
link_size = link_length; idx_t link_size = link_length;
if (link_size < buf_size) if (link_size < buf_size)
{ {
@ -127,17 +125,13 @@ readlink_stk (int fd, char const *filename,
if (buf != buffer) if (buf != buffer)
alloc->free (buf); alloc->free (buf);
if (buf_size < buf_size_max / 2) if (buf_size_max / 2 <= buf_size)
buf_size = 2 * buf_size + 1;
else if (buf_size < buf_size_max)
buf_size = buf_size_max;
else if (buf_size_max < SIZE_MAX)
{ {
errno = ENAMETOOLONG; errno = ENAMETOOLONG;
return NULL; return NULL;
} }
else
break; buf_size = 2 * buf_size + 1;
buf = alloc->allocate (buf_size); buf = alloc->allocate (buf_size);
} }

View file

@ -2,17 +2,17 @@
Copyright (C) 2011-2021 Free Software Foundation, Inc. Copyright (C) 2011-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */

View file

@ -2,16 +2,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
@ -259,9 +259,7 @@
# define __attribute_const__ /* Ignore */ # define __attribute_const__ /* Ignore */
#endif #endif
#if defined __STDC_VERSION__ && 201710L < __STDC_VERSION__ #if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
# define __attribute_maybe_unused__ [[__maybe_unused__]]
#elif __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
# define __attribute_maybe_unused__ __attribute__ ((__unused__)) # define __attribute_maybe_unused__ __attribute__ ((__unused__))
#else #else
# define __attribute_maybe_unused__ /* Ignore */ # define __attribute_maybe_unused__ /* Ignore */
@ -320,16 +318,28 @@
#endif #endif
/* The nonnull function attribute marks pointer parameters that /* The nonnull function attribute marks pointer parameters that
must not be NULL. */ must not be NULL. This has the name __nonnull in glibc,
#ifndef __nonnull and __attribute_nonnull__ in files shared with Gnulib to avoid
collision with a different __nonnull in DragonFlyBSD 5.9. */
#ifndef __attribute_nonnull__
# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
# define __nonnull(params) __attribute__ ((__nonnull__ params)) # define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
# else # else
# define __nonnull(params) # define __attribute_nonnull__(params)
# endif
#endif
#ifndef __nonnull
# define __nonnull(params) __attribute_nonnull__ (params)
#endif
/* The returns_nonnull function attribute marks the return type of the function
as always being non-null. */
#ifndef __returns_nonnull
# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__)
# define __returns_nonnull __attribute__ ((__returns_nonnull__))
# else
# define __returns_nonnull
# endif # endif
#elif !defined __GLIBC__
# undef __nonnull
# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params)
#endif #endif
/* If fortification mode, we warn about unused results of certain /* If fortification mode, we warn about unused results of certain
@ -485,9 +495,9 @@
[!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
#endif #endif
/* The #ifndef lets Gnulib avoid including these on non-glibc /* Gnulib avoids including these, as they don't work on non-glibc or
platforms, where the includes typically do not exist. */ older glibc platforms. */
#ifndef __WORDSIZE #ifndef __GNULIB_CDEFS
# include <bits/wordsize.h> # include <bits/wordsize.h>
# include <bits/long-double.h> # include <bits/long-double.h>
#endif #endif
@ -594,9 +604,26 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
array according to access mode, or at least one element when array according to access mode, or at least one element when
size-index is not provided: size-index is not provided:
access (access-mode, <ref-index> [, <size-index>]) */ access (access-mode, <ref-index> [, <size-index>]) */
#define __attr_access(x) __attribute__ ((__access__ x)) # define __attr_access(x) __attribute__ ((__access__ x))
# if __GNUC_PREREQ (11, 0)
# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno)))
# else
# define __attr_access_none(argno)
# endif
#else #else
# define __attr_access(x) # define __attr_access(x)
# define __attr_access_none(argno)
#endif
#if __GNUC_PREREQ (11, 0)
/* Designates dealloc as a function to call to deallocate objects
allocated by the declared function. */
# define __attr_dealloc(dealloc, argno) \
__attribute__ ((__malloc__ (dealloc, argno)))
# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1)
#else
# define __attr_dealloc(dealloc, argno)
# define __attr_dealloc_free
#endif #endif
/* Specify that a function such as setjmp or vfork may return /* Specify that a function such as setjmp or vfork may return

View file

@ -2,20 +2,20 @@
Copyright (C) 1991, 2004-2006, 2009-2021 Free Software Foundation, Inc. Copyright (C) 1991, 2004-2006, 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>. */
The code is taken from glibc/manual/llio.texi */ /* The code is taken from glibc/manual/llio.texi */
#include <config.h> #include <config.h>

View file

@ -2,20 +2,18 @@
Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc. Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>. */
*/
#include <stdbool.h> #include <stdbool.h>

View file

@ -1,2 +1,20 @@
/* Close a stream, with nicer error checking than fclose's.
Copyright (C) 2006-2021 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <stdio.h> #include <stdio.h>
int close_stream (FILE *stream); int close_stream (FILE *stream);

View file

@ -1,17 +1,17 @@
/* Stub for copy_file_range /* Stub for copy_file_range
Copyright 2019-2021 Free Software Foundation, Inc. Copyright 2019-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>

View file

@ -1,3 +1,21 @@
/* Count the number of leading 0 bits in a word.
Copyright (C) 2012-2021 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
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#define COUNT_LEADING_ZEROS_INLINE _GL_EXTERN_INLINE #define COUNT_LEADING_ZEROS_INLINE _GL_EXTERN_INLINE
#include "count-leading-zeros.h" #include "count-leading-zeros.h"

View file

@ -1,17 +1,17 @@
/* count-leading-zeros.h -- counts the number of leading 0 bits in a word. /* count-leading-zeros.h -- counts the number of leading 0 bits in a word.
Copyright (C) 2012-2021 Free Software Foundation, Inc. Copyright (C) 2012-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */ /* Written by Eric Blake. */

View file

@ -1,4 +1,22 @@
/* Count the number of 1-bits in a word.
Copyright (C) 2012-2021 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
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#define COUNT_ONE_BITS_INLINE _GL_EXTERN_INLINE #define COUNT_ONE_BITS_INLINE _GL_EXTERN_INLINE
#include "count-one-bits.h" #include "count-one-bits.h"

View file

@ -1,17 +1,17 @@
/* count-one-bits.h -- counts the number of 1-bits in a word. /* count-one-bits.h -- counts the number of 1-bits in a word.
Copyright (C) 2007-2021 Free Software Foundation, Inc. Copyright (C) 2007-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff. */ /* Written by Ben Pfaff. */

View file

@ -1,3 +1,21 @@
/* Count the number of trailing 0 bits in a word.
Copyright 2013-2021 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
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#define COUNT_TRAILING_ZEROS_INLINE _GL_EXTERN_INLINE #define COUNT_TRAILING_ZEROS_INLINE _GL_EXTERN_INLINE
#include "count-trailing-zeros.h" #include "count-trailing-zeros.h"

View file

@ -1,17 +1,17 @@
/* count-trailing-zeros.h -- counts the number of trailing 0 bits in a word. /* count-trailing-zeros.h -- counts the number of trailing 0 bits in a word.
Copyright 2013-2021 Free Software Foundation, Inc. Copyright 2013-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */ /* Written by Paul Eggert. */

View file

@ -1,17 +1,17 @@
/* A GNU-like <dirent.h>. /* A GNU-like <dirent.h>.
Copyright (C) 2006-2021 Free Software Foundation, Inc. Copyright (C) 2006-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_DIRENT_H #ifndef _@GUARD_PREFIX@_DIRENT_H
@ -55,6 +55,28 @@ typedef struct gl_directory DIR;
# endif # endif
#endif #endif
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
that can be freed by passing them as the Ith argument to the
function F. */
#ifndef _GL_ATTRIBUTE_DEALLOC
# if __GNUC__ >= 11
# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
# else
# define _GL_ATTRIBUTE_DEALLOC(f, i)
# endif
#endif
/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
allocated memory. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_MALLOC
# if __GNUC__ >= 3 || defined __clang__
# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
# else
# define _GL_ATTRIBUTE_MALLOC
# endif
#endif
/* The __attribute__ feature is available in gcc versions 2.5 and later. /* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */ The attribute __pure__ was added in gcc 2.96. */
#ifndef _GL_ATTRIBUTE_PURE #ifndef _GL_ATTRIBUTE_PURE
@ -74,6 +96,30 @@ typedef struct gl_directory DIR;
/* Declare overridden functions. */ /* Declare overridden functions. */
#if @GNULIB_CLOSEDIR@
# if @REPLACE_CLOSEDIR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef closedir
# define closedir rpl_closedir
# define GNULIB_defined_closedir 1
# endif
_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
# else
# if !@HAVE_CLOSEDIR@
_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
# endif
_GL_CXXALIASWARN (closedir);
#elif defined GNULIB_POSIXCHECK
# undef closedir
# if HAVE_RAW_DECL_CLOSEDIR
_GL_WARN_ON_USE (closedir, "closedir is not portable - "
"use gnulib module closedir for portability");
# endif
#endif
#if @GNULIB_OPENDIR@ #if @GNULIB_OPENDIR@
# if @REPLACE_OPENDIR@ # if @REPLACE_OPENDIR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@ -81,20 +127,36 @@ typedef struct gl_directory DIR;
# define opendir rpl_opendir # define opendir rpl_opendir
# define GNULIB_defined_opendir 1 # define GNULIB_defined_opendir 1
# endif # endif
_GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); _GL_FUNCDECL_RPL (opendir, DIR *,
(const char *dir_name)
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
_GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name)); _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name));
# else # else
# if !@HAVE_OPENDIR@ # if !@HAVE_OPENDIR@ || __GNUC__ >= 11
_GL_FUNCDECL_SYS (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); _GL_FUNCDECL_SYS (opendir, DIR *,
(const char *dir_name)
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
# endif # endif
_GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name)); _GL_CXXALIAS_SYS (opendir, DIR *, (const char *dir_name));
# endif # endif
_GL_CXXALIASWARN (opendir); _GL_CXXALIASWARN (opendir);
#elif defined GNULIB_POSIXCHECK #else
# undef opendir # if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined opendir
# if HAVE_RAW_DECL_OPENDIR /* For -Wmismatched-dealloc: Associate opendir with closedir or
rpl_closedir. */
_GL_FUNCDECL_SYS (opendir, DIR *,
(const char *dir_name)
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
# endif
# if defined GNULIB_POSIXCHECK
# undef opendir
# if HAVE_RAW_DECL_OPENDIR
_GL_WARN_ON_USE (opendir, "opendir is not portable - " _GL_WARN_ON_USE (opendir, "opendir is not portable - "
"use gnulib module opendir for portability"); "use gnulib module opendir for portability");
# endif
# endif # endif
#endif #endif
@ -126,30 +188,6 @@ _GL_WARN_ON_USE (rewinddir, "rewinddir is not portable - "
# endif # endif
#endif #endif
#if @GNULIB_CLOSEDIR@
# if @REPLACE_CLOSEDIR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef closedir
# define closedir rpl_closedir
# define GNULIB_defined_closedir 1
# endif
_GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (closedir, int, (DIR *dirp));
# else
# if !@HAVE_CLOSEDIR@
_GL_FUNCDECL_SYS (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (closedir, int, (DIR *dirp));
# endif
_GL_CXXALIASWARN (closedir);
#elif defined GNULIB_POSIXCHECK
# undef closedir
# if HAVE_RAW_DECL_CLOSEDIR
_GL_WARN_ON_USE (closedir, "closedir is not portable - "
"use gnulib module closedir for portability");
# endif
#endif
#if @GNULIB_DIRFD@ #if @GNULIB_DIRFD@
/* Return the file descriptor associated with the given directory stream, /* Return the file descriptor associated with the given directory stream,
or -1 if none exists. */ or -1 if none exists. */
@ -200,20 +238,33 @@ _GL_WARN_ON_USE (dirfd, "dirfd is unportable - "
# undef fdopendir # undef fdopendir
# define fdopendir rpl_fdopendir # define fdopendir rpl_fdopendir
# endif # endif
_GL_FUNCDECL_RPL (fdopendir, DIR *, (int fd)); _GL_FUNCDECL_RPL (fdopendir, DIR *,
(int fd)
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
_GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd)); _GL_CXXALIAS_RPL (fdopendir, DIR *, (int fd));
# else # else
# if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ # if !@HAVE_FDOPENDIR@ || !@HAVE_DECL_FDOPENDIR@ || __GNUC__ >= 11
_GL_FUNCDECL_SYS (fdopendir, DIR *, (int fd)); _GL_FUNCDECL_SYS (fdopendir, DIR *,
(int fd)
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
# endif # endif
_GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd)); _GL_CXXALIAS_SYS (fdopendir, DIR *, (int fd));
# endif # endif
_GL_CXXALIASWARN (fdopendir); _GL_CXXALIASWARN (fdopendir);
#elif defined GNULIB_POSIXCHECK #else
# undef fdopendir # if @GNULIB_CLOSEDIR@ && __GNUC__ >= 11 && !defined fdopendir
# if HAVE_RAW_DECL_FDOPENDIR /* For -Wmismatched-dealloc: Associate fdopendir with closedir or
rpl_closedir. */
_GL_FUNCDECL_SYS (fdopendir, DIR *,
(int fd)
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC (closedir, 1));
# endif
# if defined GNULIB_POSIXCHECK
# undef fdopendir
# if HAVE_RAW_DECL_FDOPENDIR
_GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - " _GL_WARN_ON_USE (fdopendir, "fdopendir is unportable - "
"use gnulib module fdopendir for portability"); "use gnulib module fdopendir for portability");
# endif
# endif # endif
#endif #endif

View file

@ -2,17 +2,17 @@
Copyright (C) 2001, 2006, 2008-2021 Free Software Foundation, Inc. Copyright (C) 2001, 2006, 2008-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Jim Meyering. */ /* Written by Jim Meyering. */

View file

@ -1,2 +1,19 @@
/* Convert 'double' to accurate string.
Copyright (C) 2010-2021 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#define LENGTH 2 #define LENGTH 2
#include "ftoastr.c" #include "ftoastr.c"

View file

@ -2,17 +2,17 @@
Copyright (C) 1999, 2004-2007, 2009-2021 Free Software Foundation, Inc. Copyright (C) 1999, 2004-2007, 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Paul Eggert */ /* written by Paul Eggert */

View file

@ -1,31 +1,284 @@
/* Type-safe arrays which grow dynamically. /* Type-safe arrays which grow dynamically.
Copyright 2021 Free Software Foundation, Inc. Copyright 2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert, 2021. */ /* Written by Paul Eggert and Bruno Haible, 2021. */
#ifndef _GL_DYNARRAY_H #ifndef _GL_DYNARRAY_H
#define _GL_DYNARRAY_H #define _GL_DYNARRAY_H
#include <libc-config.h> /* Before including this file, you need to define:
DYNARRAY_STRUCT
The struct tag of dynamic array to be defined.
DYNARRAY_ELEMENT
The type name of the element type. Elements are copied
as if by memcpy, and can change address as the dynamic
array grows.
DYNARRAY_PREFIX
The prefix of the functions which are defined.
The following parameters are optional:
DYNARRAY_ELEMENT_FREE
DYNARRAY_ELEMENT_FREE (E) is evaluated to deallocate the
contents of elements. E is of type DYNARRAY_ELEMENT *.
DYNARRAY_ELEMENT_INIT
DYNARRAY_ELEMENT_INIT (E) is evaluated to initialize a new
element. E is of type DYNARRAY_ELEMENT *.
If DYNARRAY_ELEMENT_FREE but not DYNARRAY_ELEMENT_INIT is
defined, new elements are automatically zero-initialized.
Otherwise, new elements have undefined contents.
DYNARRAY_INITIAL_SIZE
The size of the statically allocated array (default:
at least 2, more elements if they fit into 128 bytes).
Must be a preprocessor constant. If DYNARRAY_INITIAL_SIZE is 0,
there is no statically allocated array at, and all non-empty
arrays are heap-allocated.
DYNARRAY_FINAL_TYPE
The name of the type which holds the final array. If not
defined, is PREFIX##finalize not provided. DYNARRAY_FINAL_TYPE
must be a struct type, with members of type DYNARRAY_ELEMENT and
size_t at the start (in this order).
These macros are undefined after this header file has been
included.
The following types are provided (their members are private to the
dynarray implementation):
struct DYNARRAY_STRUCT
The following functions are provided:
*/
/* Initialize a dynamic array object. This must be called before any
use of the object. */
#if 0
static void
DYNARRAY_PREFIX##init (struct DYNARRAY_STRUCT *list);
#endif
/* Deallocate the dynamic array and its elements. */
#if 0
static void
DYNARRAY_PREFIX##free (struct DYNARRAY_STRUCT *list);
#endif
/* Return true if the dynamic array is in an error state. */
#if 0
static bool
DYNARRAY_PREFIX##has_failed (const struct DYNARRAY_STRUCT *list);
#endif
/* Mark the dynamic array as failed. All elements are deallocated as
a side effect. */
#if 0
static void
DYNARRAY_PREFIX##mark_failed (struct DYNARRAY_STRUCT *list);
#endif
/* Return the number of elements which have been added to the dynamic
array. */
#if 0
static size_t
DYNARRAY_PREFIX##size (const struct DYNARRAY_STRUCT *list);
#endif
/* Return a pointer to the first array element, if any. For a
zero-length array, the pointer can be NULL even though the dynamic
array has not entered the failure state. */
#if 0
static DYNARRAY_ELEMENT *
DYNARRAY_PREFIX##begin (const struct DYNARRAY_STRUCT *list);
#endif
/* Return a pointer one element past the last array element. For a
zero-length array, the pointer can be NULL even though the dynamic
array has not entered the failure state. */
#if 0
static DYNARRAY_ELEMENT *
DYNARRAY_PREFIX##end (const struct DYNARRAY_STRUCT *list);
#endif
/* Return a pointer to the array element at INDEX. Terminate the
process if INDEX is out of bounds. */
#if 0
static DYNARRAY_ELEMENT *
DYNARRAY_PREFIX##at (struct DYNARRAY_STRUCT *list, size_t index);
#endif
/* Add ITEM at the end of the array, enlarging it by one element.
Mark *LIST as failed if the dynamic array allocation size cannot be
increased. */
#if 0
static void
DYNARRAY_PREFIX##add (struct DYNARRAY_STRUCT *list,
DYNARRAY_ELEMENT item);
#endif
/* Allocate a place for a new element in *LIST and return a pointer to
it. The pointer can be NULL if the dynamic array cannot be
enlarged due to a memory allocation failure. */
#if 0
static DYNARRAY_ELEMENT *
DYNARRAY_PREFIX##emplace (struct DYNARRAY_STRUCT *list);
#endif
/* Change the size of *LIST to SIZE. If SIZE is larger than the
existing size, new elements are added (which can be initialized).
Otherwise, the list is truncated, and elements are freed. Return
false on memory allocation failure (and mark *LIST as failed). */
#if 0
static bool
DYNARRAY_PREFIX##resize (struct DYNARRAY_STRUCT *list, size_t size);
#endif
/* Remove the last element of LIST if it is present. */
#if 0
static void
DYNARRAY_PREFIX##remove_last (struct DYNARRAY_STRUCT *list);
#endif
/* Remove all elements from the list. The elements are freed, but the
list itself is not. */
#if 0
static void
DYNARRAY_PREFIX##clear (struct DYNARRAY_STRUCT *list);
#endif
#if defined DYNARRAY_FINAL_TYPE
/* Transfer the dynamic array to a permanent location at *RESULT.
Returns true on success on false on allocation failure. In either
case, *LIST is re-initialized and can be reused. A NULL pointer is
stored in *RESULT if LIST refers to an empty list. On success, the
pointer in *RESULT is heap-allocated and must be deallocated using
free. */
#if 0
static bool
DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *list,
DYNARRAY_FINAL_TYPE *result);
#endif
#else /* !defined DYNARRAY_FINAL_TYPE */
/* Transfer the dynamic array to a heap-allocated array and return a
pointer to it. The pointer is NULL if memory allocation fails, or
if the array is empty, so this function should be used only for
arrays which are known not be empty (usually because they always
have a sentinel at the end). If LENGTHP is not NULL, the array
length is written to *LENGTHP. *LIST is re-initialized and can be
reused. */
#if 0
static DYNARRAY_ELEMENT *
DYNARRAY_PREFIX##finalize (struct DYNARRAY_STRUCT *list,
size_t *lengthp);
#endif
#endif
/* A minimal example which provides a growing list of integers can be
defined like this:
struct int_array
{
// Pointer to result array followed by its length,
// as required by DYNARRAY_FINAL_TYPE.
int *array;
size_t length;
};
#define DYNARRAY_STRUCT dynarray_int
#define DYNARRAY_ELEMENT int
#define DYNARRAY_PREFIX dynarray_int_
#define DYNARRAY_FINAL_TYPE struct int_array
#include <malloc/dynarray-skeleton.c>
To create a three-element array with elements 1, 2, 3, use this
code:
struct dynarray_int dyn;
dynarray_int_init (&dyn);
for (int i = 1; i <= 3; ++i)
{
int *place = dynarray_int_emplace (&dyn);
assert (place != NULL);
*place = i;
}
struct int_array result;
bool ok = dynarray_int_finalize (&dyn, &result);
assert (ok);
assert (result.length == 3);
assert (result.array[0] == 1);
assert (result.array[1] == 2);
assert (result.array[2] == 3);
free (result.array);
If the elements contain resources which must be freed, define
DYNARRAY_ELEMENT_FREE appropriately, like this:
struct str_array
{
char **array;
size_t length;
};
#define DYNARRAY_STRUCT dynarray_str
#define DYNARRAY_ELEMENT char *
#define DYNARRAY_ELEMENT_FREE(ptr) free (*ptr)
#define DYNARRAY_PREFIX dynarray_str_
#define DYNARRAY_FINAL_TYPE struct str_array
#include <malloc/dynarray-skeleton.c>
*/
/* The implementation is imported from glibc. */
/* Avoid possible conflicts with symbols exported by the GNU libc. */
#define __libc_dynarray_at_failure gl_dynarray_at_failure #define __libc_dynarray_at_failure gl_dynarray_at_failure
#define __libc_dynarray_emplace_enlarge gl_dynarray_emplace_enlarge #define __libc_dynarray_emplace_enlarge gl_dynarray_emplace_enlarge
#define __libc_dynarray_finalize gl_dynarray_finalize #define __libc_dynarray_finalize gl_dynarray_finalize
#define __libc_dynarray_resize_clear gl_dynarray_resize_clear #define __libc_dynarray_resize_clear gl_dynarray_resize_clear
#define __libc_dynarray_resize gl_dynarray_resize #define __libc_dynarray_resize gl_dynarray_resize
#include <malloc/dynarray.h>
#if defined DYNARRAY_STRUCT || defined DYNARRAY_ELEMENT || defined DYNARRAY_PREFIX
# ifndef _GL_LIKELY
/* Rely on __builtin_expect, as provided by the module 'builtin-expect'. */
# define _GL_LIKELY(cond) __builtin_expect ((cond), 1)
# define _GL_UNLIKELY(cond) __builtin_expect ((cond), 0)
# endif
/* Define auxiliary structs and declare auxiliary functions, common to all
instantiations of dynarray. */
# include <malloc/dynarray.gl.h>
/* Define the instantiation, specified through
DYNARRAY_STRUCT
DYNARRAY_ELEMENT
DYNARRAY_PREFIX
etc. */
# include <malloc/dynarray-skeleton.gl.h>
#else
/* This file is being included from one of the malloc/dynarray_*.c files. */
# include <malloc/dynarray.h>
#endif
#endif /* _GL_DYNARRAY_H */ #endif /* _GL_DYNARRAY_H */

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -2,18 +2,18 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc. Copyright (C) 2008-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3, or (at your option) published by the Free Software Foundation; either version 2.1 of the
any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ERRNO_H #ifndef _@GUARD_PREFIX@_ERRNO_H

View file

@ -5,17 +5,17 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by David MacKenzie and Torbjorn Granlund. /* Written by David MacKenzie and Torbjorn Granlund.

View file

@ -1,3 +1,21 @@
/* Information about executables.
Copyright (C) 2012-2021 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
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#define _GL_EXECINFO_INLINE _GL_EXTERN_INLINE #define _GL_EXECINFO_INLINE _GL_EXTERN_INLINE
#include "execinfo.h" #include "execinfo.h"

View file

@ -3,16 +3,16 @@
Copyright (C) 2012-2021 Free Software Foundation, Inc. Copyright (C) 2012-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */ /* Written by Paul Eggert. */

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -2,17 +2,17 @@
Copyright (C) 2009-2021 Free Software Foundation, Inc. Copyright (C) 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Eric Blake <ebb9@byu.net>. */ /* Written by Eric Blake <ebb9@byu.net>. */

View file

@ -2,17 +2,17 @@
Copyright (C) 2006-2021 Free Software Foundation, Inc. Copyright (C) 2006-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Paul Eggert */ /* written by Paul Eggert */

View file

@ -1,6 +1,6 @@
/* Test whether a file has a nontrivial ACL. -*- coding: utf-8 -*- /* Test whether a file has a nontrivial ACL. -*- coding: utf-8 -*-
Copyright (C) 2002-2003, 2005-2020 Free Software Foundation, Inc. Copyright (C) 2002-2003, 2005-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -206,9 +206,7 @@ file_has_acl (char const *name, struct stat const *sb)
; ;
else else
{ {
int saved_errno = errno;
free (malloced); free (malloced);
errno = saved_errno;
return -1; return -1;
} }
} }
@ -281,9 +279,7 @@ file_has_acl (char const *name, struct stat const *sb)
; ;
else else
{ {
int saved_errno = errno;
free (malloced); free (malloced);
errno = saved_errno;
return -1; return -1;
} }
} }
@ -353,7 +349,7 @@ file_has_acl (char const *name, struct stat const *sb)
{ {
struct stat statbuf; struct stat statbuf;
if (stat (name, &statbuf) < 0) if (stat (name, &statbuf) == -1 && errno != EOVERFLOW)
return -1; return -1;
return acl_nontrivial (count, entries); return acl_nontrivial (count, entries);
@ -418,11 +414,7 @@ file_has_acl (char const *name, struct stat const *sb)
if (errno != ENOSPC) if (errno != ENOSPC)
{ {
if (acl != aclbuf) if (acl != aclbuf)
{ free (acl);
int saved_errno = errno;
free (acl);
errno = saved_errno;
}
return -1; return -1;
} }
aclsize = 2 * aclsize; aclsize = 2 * aclsize;

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -3,18 +3,18 @@
Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au> Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
Copyright (C) 2008-2021 Free Software Foundation, Inc. Copyright (C) 2008-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation, either version 3 of the License, or published by the Free Software Foundation; either version 3 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#include "filevercmp.h" #include "filevercmp.h"

View file

@ -3,18 +3,18 @@
Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au> Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
Copyright (C) 2008-2021 Free Software Foundation, Inc. Copyright (C) 2008-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation, either version 3 of the License, or published by the Free Software Foundation; either version 3 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef FILEVERCMP_H #ifndef FILEVERCMP_H
#define FILEVERCMP_H #define FILEVERCMP_H

View file

@ -5,16 +5,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. <https://www.gnu.org/licenses/>.

View file

@ -2,32 +2,36 @@
Copyright (C) 2003, 2006, 2009-2021 Free Software Foundation, Inc. Copyright (C) 2003, 2006, 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Paul Eggert */ /* written by Paul Eggert */
#include <config.h> #include <config.h>
/* Specification. */
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> /* A function definition is only needed if HAVE_FREE_POSIX is not defined. */
#if !HAVE_FREE_POSIX
# include <errno.h>
void void
rpl_free (void *p) rpl_free (void *p)
#undef free # undef free
{ {
#if defined __GNUC__ && !defined __clang__ # if defined __GNUC__ && !defined __clang__
/* An invalid GCC optimization /* An invalid GCC optimization
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98396> <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98396>
would optimize away the assignments in the code below, when link-time would optimize away the assignments in the code below, when link-time
@ -39,9 +43,11 @@ rpl_free (void *p)
errno = 0; errno = 0;
free (p); free (p);
errno = err[errno == 0]; errno = err[errno == 0];
#else # else
int err = errno; int err = errno;
free (p); free (p);
errno = err; errno = err;
#endif # endif
} }
#endif

View file

@ -3,17 +3,17 @@
Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2021 Free Software Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2021 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 3 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>

View file

@ -3,17 +3,17 @@
Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2021 Free Software Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2021 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 3 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Space usage statistics for a file system. Blocks are 512-byte. */ /* Space usage statistics for a file system. Blocks are 512-byte. */

View file

@ -9,17 +9,17 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc. Copyright (C) 2008-2021 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or This file is free software: you can redistribute it and/or modify
modify it under the terms of the GNU General Public it under the terms of the GNU Lesser General Public License as
License as published by the Free Software Foundation; either published by the Free Software Foundation; either version 2.1 of the
version 3 of the License, or (at your option) any later version. License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>

View file

@ -1,17 +1,17 @@
/* Set the access and modification time of an open fd. /* Set the access and modification time of an open fd.
Copyright (C) 2009-2021 Free Software Foundation, Inc. Copyright (C) 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 3 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Eric Blake */ /* written by Eric Blake */

View file

@ -2,17 +2,17 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc. Copyright (C) 2008-2021 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008. Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>

View file

@ -2,17 +2,17 @@
Copyright (C) 1996, 1999, 2003, 2006-2021 Free Software Foundation, Inc. Copyright (C) 1996, 1999, 2003, 2006-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Jim Meyering */ /* written by Jim Meyering */
@ -30,7 +30,7 @@
/* Provide a stub that fails with ENOSYS, since there is no group /* Provide a stub that fails with ENOSYS, since there is no group
information available on mingw. */ information available on mingw. */
int int
getgroups (int n _GL_UNUSED, GETGROUPS_T *groups _GL_UNUSED) getgroups (_GL_UNUSED int n, _GL_UNUSED GETGROUPS_T *groups)
{ {
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
@ -70,7 +70,6 @@ rpl_getgroups (int n, gid_t *group)
{ {
int n_groups; int n_groups;
GETGROUPS_T *gbuf; GETGROUPS_T *gbuf;
int saved_errno;
if (n < 0) if (n < 0)
{ {
@ -99,9 +98,7 @@ rpl_getgroups (int n, gid_t *group)
while (n--) while (n--)
group[n] = gbuf[n]; group[n] = gbuf[n];
} }
saved_errno = errno;
free (gbuf); free (gbuf);
errno = saved_errno;
return result; return result;
} }
@ -121,10 +118,7 @@ rpl_getgroups (int n, gid_t *group)
n *= 2; n *= 2;
} }
saved_errno = errno;
free (gbuf); free (gbuf);
errno = saved_errno;
return n_groups; return n_groups;
} }

View file

@ -4,19 +4,18 @@
Unlike most of the getopt implementation, it is NOT shared Unlike most of the getopt implementation, it is NOT shared
with the GNU C Library. with the GNU C Library.
This file is free software; you can redistribute it and/or modify it This file is free software: you can redistribute it and/or modify
under the terms of the GNU General Public License as it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of published by the Free Software Foundation; either version 2.1 of the
the License, or (at your option) any later version. License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but This file is distributed in the hope that it will be useful,
WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public License
License along with gnulib; if not, see along with this program. If not, see <https://www.gnu.org/licenses/>. */
<https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_CDEFS_H #ifndef _GETOPT_CDEFS_H
#define _GETOPT_CDEFS_H 1 #define _GETOPT_CDEFS_H 1

View file

@ -4,16 +4,16 @@
Patches to this file should be submitted to both projects. Patches to this file should be submitted to both projects.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -4,16 +4,16 @@
Patches to this file should be submitted to both projects. Patches to this file should be submitted to both projects.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -4,19 +4,18 @@
Unlike most of the getopt implementation, it is NOT shared Unlike most of the getopt implementation, it is NOT shared
with the GNU C Library. with the GNU C Library.
This file is free software; you can redistribute it and/or modify it This file is free software: you can redistribute it and/or modify
under the terms of the GNU General Public License as it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of published by the Free Software Foundation; either version 2.1 of the
the License, or (at your option) any later version. License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but This file is distributed in the hope that it will be useful,
WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public License
License along with gnulib; if not, see along with this program. If not, see <https://www.gnu.org/licenses/>. */
<https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_PFX_CORE_H #ifndef _GETOPT_PFX_CORE_H
#define _GETOPT_PFX_CORE_H 1 #define _GETOPT_PFX_CORE_H 1

View file

@ -4,19 +4,18 @@
Unlike most of the getopt implementation, it is NOT shared Unlike most of the getopt implementation, it is NOT shared
with the GNU C Library. with the GNU C Library.
This file is free software; you can redistribute it and/or modify it This file is free software: you can redistribute it and/or modify
under the terms of the GNU General Public License as it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of published by the Free Software Foundation; either version 2.1 of the
the License, or (at your option) any later version. License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but This file is distributed in the hope that it will be useful,
WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public License
License along with gnulib; if not, see along with this program. If not, see <https://www.gnu.org/licenses/>. */
<https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_PFX_EXT_H #ifndef _GETOPT_PFX_EXT_H
#define _GETOPT_PFX_EXT_H 1 #define _GETOPT_PFX_EXT_H 1

View file

@ -4,16 +4,16 @@
Patches to this file should be submitted to both projects. Patches to this file should be submitted to both projects.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
@ -378,8 +378,8 @@ process_long_option (int argc, char **argv, const char *optstring,
/* Initialize internal data upon the first call to getopt. */ /* Initialize internal data upon the first call to getopt. */
static const char * static const char *
_getopt_initialize (int argc _GL_UNUSED, _getopt_initialize (_GL_UNUSED int argc,
char **argv _GL_UNUSED, const char *optstring, _GL_UNUSED char **argv, const char *optstring,
struct _getopt_data *d, int posixly_correct) struct _getopt_data *d, int posixly_correct)
{ {
/* Start processing options with ARGV-element 1 (since ARGV-element 0 /* Start processing options with ARGV-element 1 (since ARGV-element 0

View file

@ -5,18 +5,18 @@
with the GNU C Library, which supplies a different version of with the GNU C Library, which supplies a different version of
this file. this file.
This file is free software; you can redistribute it and/or modify it This file is free software: you can redistribute it and/or modify
under the terms of the GNU General Public License as it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of published by the Free Software Foundation; either version 2.1 of the
the License, or (at your option) any later version. License, or (at your option) any later version.
This file is distributed in the hope that it will be useful, but This file is distributed in the hope that it will be useful,
WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public License
License along with gnulib; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_GETOPT_H #ifndef _@GUARD_PREFIX@_GETOPT_H

View file

@ -4,16 +4,16 @@
Patches to this file should be submitted to both projects. Patches to this file should be submitted to both projects.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -4,16 +4,16 @@
Patches to this file should be submitted to both projects. Patches to this file should be submitted to both projects.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -2,17 +2,17 @@
Copyright 2020-2021 Free Software Foundation, Inc. Copyright 2020-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */ /* Written by Paul Eggert. */
@ -178,7 +178,11 @@ getrandom (void *buffer, size_t length, unsigned int flags)
+ (flags & GRND_NONBLOCK ? O_NONBLOCK : 0)); + (flags & GRND_NONBLOCK ? O_NONBLOCK : 0));
fd = open (randdevice[devrandom], oflags); fd = open (randdevice[devrandom], oflags);
if (fd < 0) if (fd < 0)
return fd; {
if (errno == ENOENT || errno == ENOTDIR)
errno = ENOSYS;
return -1;
}
randfd[devrandom] = fd; randfd[devrandom] = fd;
} }

View file

@ -2,18 +2,18 @@
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 Free Software Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software; you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3, or (at your option) published by the Free Software Foundation; either version 2.1 of the
any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU Lesser General Public License
with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _LIBGETTEXT_H #ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1 #define _LIBGETTEXT_H 1

View file

@ -2,17 +2,17 @@
Copyright (C) 2002, 2004-2007, 2009-2021 Free Software Foundation, Inc. Copyright (C) 2002, 2004-2007, 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 3 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */ /* Written by Paul Eggert. */

View file

@ -2,18 +2,18 @@
Copyright (C) 2001-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc. Copyright (C) 2001-2003, 2005-2007, 2009-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3, or (at your option) published by the Free Software Foundation; either version 2.1 of the
any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Jim Meyering */ /* written by Jim Meyering */

File diff suppressed because it is too large Load diff

View file

@ -3,17 +3,17 @@
Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2021 Free Software Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2021 Free Software
Foundation, Inc. Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
@ -25,7 +25,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h> #include <stdlib.h>
#include "xalloc-oversized.h" #include "intprops.h"
/* Most processes have no more than this many groups, and for these /* Most processes have no more than this many groups, and for these
processes we can avoid using malloc. */ processes we can avoid using malloc. */
@ -53,10 +53,10 @@ get_group_info (struct group_info *gi)
if (n_groups < 0) if (n_groups < 0)
{ {
int n_group_slots = getgroups (0, NULL); int n_group_slots = getgroups (0, NULL);
if (0 <= n_group_slots size_t nbytes;
&& ! xalloc_oversized (n_group_slots, sizeof *gi->group)) if (! INT_MULTIPLY_WRAPV (n_group_slots, sizeof *gi->group, &nbytes))
{ {
gi->group = malloc (n_group_slots * sizeof *gi->group); gi->group = malloc (nbytes);
if (gi->group) if (gi->group)
n_groups = getgroups (n_group_slots, gi->group); n_groups = getgroups (n_group_slots, gi->group);
} }

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
@ -56,6 +56,26 @@
* Because 'size_t' is an unsigned type, and a signed type is better. * Because 'size_t' is an unsigned type, and a signed type is better.
See above. See above.
Why not use 'ssize_t'?
* 'ptrdiff_t' is more portable; it is standardized by ISO C
whereas 'ssize_t' is standardized only by POSIX.
* 'ssize_t' is not required to be as wide as 'size_t', and some
now-obsolete POSIX platforms had 'size_t' wider than 'ssize_t'.
* Conversely, some now-obsolete platforms had 'ptrdiff_t' wider
than 'size_t', which can be a win and conforms to POSIX.
Won't this cause a problem with objects larger than PTRDIFF_MAX?
* Typical modern or large platforms do not allocate such objects,
so this is not much of a problem in practice; for example, you
can safely write 'idx_t len = strlen (s);'. To port to older
small platforms where allocations larger than PTRDIFF_MAX could
in theory be a problem, you can use Gnulib's ialloc module, or
functions like ximalloc in Gnulib's xalloc module.
Why not use 'ptrdiff_t' directly? Why not use 'ptrdiff_t' directly?
* Maintainability: When reading and modifying code, it helps to know that * Maintainability: When reading and modifying code, it helps to know that

View file

@ -2,16 +2,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -2,17 +2,17 @@
Copyright (C) 2008-2021 Free Software Foundation, Inc. Copyright (C) 2008-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Jim Meyering, Eric Blake and Pádraig Brady. */ /* Written by Jim Meyering, Eric Blake and Pádraig Brady. */

View file

@ -3,19 +3,18 @@
Copyright (C) 2001-2021 Free Software Foundation, Inc. Copyright (C) 2001-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
#ifndef _GL_INTPROPS_H #ifndef _GL_INTPROPS_H
#define _GL_INTPROPS_H #define _GL_INTPROPS_H
@ -133,7 +132,8 @@
operators might not yield numerically correct answers due to operators might not yield numerically correct answers due to
arithmetic overflow. They do not rely on undefined or arithmetic overflow. They do not rely on undefined or
implementation-defined behavior. Their implementations are simple implementation-defined behavior. Their implementations are simple
and straightforward, but they are a bit harder to use than the and straightforward, but they are harder to use and may be less
efficient than the INT_<op>_WRAPV, INT_<op>_OK, and
INT_<op>_OVERFLOW macros described below. INT_<op>_OVERFLOW macros described below.
Example usage: Example usage:
@ -158,6 +158,9 @@
must have minimum value MIN and maximum MAX. Unsigned types should must have minimum value MIN and maximum MAX. Unsigned types should
use a zero MIN of the proper type. use a zero MIN of the proper type.
Because all arguments are subject to integer promotions, these
macros typically do not work on types narrower than 'int'.
These macros are tuned for constant MIN and MAX. For commutative These macros are tuned for constant MIN and MAX. For commutative
operations such as A + B, they are also tuned for constant B. */ operations such as A + B, they are also tuned for constant B. */
@ -339,9 +342,15 @@
arguments should not have side effects. arguments should not have side effects.
The WRAPV macros are not constant expressions. They support only The WRAPV macros are not constant expressions. They support only
+, binary -, and *. Because the WRAPV macros convert the result, +, binary -, and *.
they report overflow in different circumstances than the OVERFLOW
macros do. Because the WRAPV macros convert the result, they report overflow
in different circumstances than the OVERFLOW macros do. For
example, in the typical case with 16-bit 'short' and 32-bit 'int',
if A, B and R are all of type 'short' then INT_ADD_OVERFLOW (A, B)
returns false because the addition cannot overflow after A and B
are converted to 'int', whereas INT_ADD_WRAPV (A, B, &R) returns
true or false depending on whether the sum fits into 'short'.
These macros are tuned for their last input argument being a constant. These macros are tuned for their last input argument being a constant.

View file

@ -2,17 +2,17 @@
Written by Paul Eggert, Bruno Haible, Derek Price. Written by Paul Eggert, Bruno Haible, Derek Price.
This file is part of gnulib. This file is part of gnulib.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* /*

View file

@ -3,16 +3,16 @@
Copyright 2017-2021 Free Software Foundation, Inc. Copyright 2017-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with this program; if not, see License along with this program; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
@ -28,14 +28,17 @@
When compiled as part of glibc this is a no-op; when compiled as When compiled as part of glibc this is a no-op; when compiled as
part of Gnulib this includes Gnulib's <config.h> and defines macros part of Gnulib this includes Gnulib's <config.h> and defines macros
that glibc library code would normally assume. */ that glibc library code would normally assume.
Note: This header file MUST NOT be included by public header files
of Gnulib. */
#include <config.h> #include <config.h>
/* On glibc this includes <features.h> and <sys/cdefs.h> and #defines /* On glibc this includes <features.h> and <sys/cdefs.h> and #defines
_FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 it _FEATURES_H, __WORDSIZE, and __set_errno. On FreeBSD 11 and
includes <sys/cdefs.h> which defines __nonnull. Elsewhere it DragonFlyBSD 5.9 it includes <sys/cdefs.h> which defines __nonnull.
is harmless. */ Elsewhere it is harmless. */
#include <errno.h> #include <errno.h>
/* From glibc <errno.h>. */ /* From glibc <errno.h>. */
@ -71,7 +74,7 @@
# endif # endif
#endif #endif
#ifndef __attribute_maybe_unused__ #ifndef __attribute_nonnull__
/* <sys/cdefs.h> either does not exist, or is too old for Gnulib. /* <sys/cdefs.h> either does not exist, or is too old for Gnulib.
Prepare to include <cdefs.h>, which is Gnulib's version of a Prepare to include <cdefs.h>, which is Gnulib's version of a
more-recent glibc <sys/cdefs.h>. */ more-recent glibc <sys/cdefs.h>. */
@ -80,13 +83,9 @@
# ifndef _FEATURES_H # ifndef _FEATURES_H
# define _FEATURES_H 1 # define _FEATURES_H 1
# endif # endif
/* Define __WORDSIZE so that <cdefs.h> does not attempt to include /* Define __GNULIB_CDEFS so that <cdefs.h> does not attempt to include
nonexistent files. Make it a syntax error, since Gnulib does not nonexistent files. */
use __WORDSIZE now, and if Gnulib uses it later the syntax error # define __GNULIB_CDEFS
will let us know that __WORDSIZE needs configuring. */
# ifndef __WORDSIZE
# define __WORDSIZE %%%
# endif
/* Undef the macros unconditionally defined by our copy of glibc /* Undef the macros unconditionally defined by our copy of glibc
<sys/cdefs.h>, so that they do not clash with any system-defined <sys/cdefs.h>, so that they do not clash with any system-defined
versions. */ versions. */
@ -118,6 +117,9 @@
# undef __THROW # undef __THROW
# undef __THROWNL # undef __THROWNL
# undef __attr_access # undef __attr_access
# undef __attr_access_none
# undef __attr_dealloc
# undef __attr_dealloc_free
# undef __attribute__ # undef __attribute__
# undef __attribute_alloc_size__ # undef __attribute_alloc_size__
# undef __attribute_artificial__ # undef __attribute_artificial__

View file

@ -2,18 +2,18 @@
Copyright 2016-2021 Free Software Foundation, Inc. Copyright 2016-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or This file is free software: you can redistribute it and/or modify
modify it under the terms of the GNU General Public License it under the terms of the GNU Lesser General Public License as
as published by the Free Software Foundation; either version 3, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -99,10 +99,11 @@
# endif # endif
#endif #endif
/* Macros specified by ISO/IEC TS 18661-1:2014. */ /* Macros specified by C2x and by ISO/IEC TS 18661-1:2014. */
#if (! defined ULLONG_WIDTH \ #if (! defined ULLONG_WIDTH \
&& (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__ \
|| (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)))
# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) # define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX)
# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) # define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX)
# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) # define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX)
@ -114,7 +115,16 @@
# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) # define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX)
# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) # define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX)
# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) # define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX)
#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ #endif
/* Macros specified by C2x. */
#if (! defined BOOL_WIDTH \
&& (defined _GNU_SOURCE \
|| (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__)))
# define BOOL_MAX 1
# define BOOL_WIDTH 1
#endif
#endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */
#endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */

View file

@ -2,17 +2,17 @@
Copyright (C) 1997-2006, 2008-2021 Free Software Foundation, Inc. Copyright (C) 1997-2006, 2008-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Lesser General Public License as
the Free Software Foundation; either version 3 of the License, or published by the Free Software Foundation; either version 2.1 of the
(at your option) any later version. License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Jim Meyering */ /* written by Jim Meyering */

51
lib/malloc.c Normal file
View file

@ -0,0 +1,51 @@
/* malloc() function that is glibc compatible.
Copyright (C) 1997-1998, 2006-2007, 2009-2021 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
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Jim Meyering and Bruno Haible */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
#include <stdlib.h>
#include <errno.h>
#include "xalloc-oversized.h"
/* Allocate an N-byte block of memory from the heap, even if N is 0. */
void *
rpl_malloc (size_t n)
{
if (n == 0)
n = 1;
if (xalloc_oversized (n, 1))
{
errno = ENOMEM;
return NULL;
}
void *result = malloc (n);
#if !HAVE_MALLOC_POSIX
if (result == NULL)
errno = ENOMEM;
#endif
return result;
}

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
@ -192,7 +192,7 @@ DYNARRAY_NAME (free__array__) (struct DYNARRAY_STRUCT *list)
/* Initialize a dynamic array object. This must be called before any /* Initialize a dynamic array object. This must be called before any
use of the object. */ use of the object. */
__nonnull ((1)) __attribute_nonnull__ ((1))
static void static void
DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list) DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list)
{ {
@ -202,7 +202,7 @@ DYNARRAY_NAME (init) (struct DYNARRAY_STRUCT *list)
} }
/* Deallocate the dynamic array and its elements. */ /* Deallocate the dynamic array and its elements. */
__attribute_maybe_unused__ __nonnull ((1)) __attribute_maybe_unused__ __attribute_nonnull__ ((1))
static void static void
DYNARRAY_FREE (struct DYNARRAY_STRUCT *list) DYNARRAY_FREE (struct DYNARRAY_STRUCT *list)
{ {
@ -213,7 +213,7 @@ DYNARRAY_FREE (struct DYNARRAY_STRUCT *list)
} }
/* Return true if the dynamic array is in an error state. */ /* Return true if the dynamic array is in an error state. */
__nonnull ((1)) __attribute_nonnull__ ((1))
static inline bool static inline bool
DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list) DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list)
{ {
@ -222,7 +222,7 @@ DYNARRAY_NAME (has_failed) (const struct DYNARRAY_STRUCT *list)
/* Mark the dynamic array as failed. All elements are deallocated as /* Mark the dynamic array as failed. All elements are deallocated as
a side effect. */ a side effect. */
__nonnull ((1)) __attribute_nonnull__ ((1))
static void static void
DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list) DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list)
{ {
@ -236,7 +236,7 @@ DYNARRAY_NAME (mark_failed) (struct DYNARRAY_STRUCT *list)
/* Return the number of elements which have been added to the dynamic /* Return the number of elements which have been added to the dynamic
array. */ array. */
__nonnull ((1)) __attribute_nonnull__ ((1))
static inline size_t static inline size_t
DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list) DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list)
{ {
@ -245,7 +245,7 @@ DYNARRAY_NAME (size) (const struct DYNARRAY_STRUCT *list)
/* Return a pointer to the array element at INDEX. Terminate the /* Return a pointer to the array element at INDEX. Terminate the
process if INDEX is out of bounds. */ process if INDEX is out of bounds. */
__nonnull ((1)) __attribute_nonnull__ ((1))
static inline DYNARRAY_ELEMENT * static inline DYNARRAY_ELEMENT *
DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index) DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index)
{ {
@ -257,7 +257,7 @@ DYNARRAY_NAME (at) (struct DYNARRAY_STRUCT *list, size_t index)
/* Return a pointer to the first array element, if any. For a /* Return a pointer to the first array element, if any. For a
zero-length array, the pointer can be NULL even though the dynamic zero-length array, the pointer can be NULL even though the dynamic
array has not entered the failure state. */ array has not entered the failure state. */
__nonnull ((1)) __attribute_nonnull__ ((1))
static inline DYNARRAY_ELEMENT * static inline DYNARRAY_ELEMENT *
DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list) DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list)
{ {
@ -267,7 +267,7 @@ DYNARRAY_NAME (begin) (struct DYNARRAY_STRUCT *list)
/* Return a pointer one element past the last array element. For a /* Return a pointer one element past the last array element. For a
zero-length array, the pointer can be NULL even though the dynamic zero-length array, the pointer can be NULL even though the dynamic
array has not entered the failure state. */ array has not entered the failure state. */
__nonnull ((1)) __attribute_nonnull__ ((1))
static inline DYNARRAY_ELEMENT * static inline DYNARRAY_ELEMENT *
DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list) DYNARRAY_NAME (end) (struct DYNARRAY_STRUCT *list)
{ {
@ -294,7 +294,7 @@ DYNARRAY_NAME (add__) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item)
/* Add ITEM at the end of the array, enlarging it by one element. /* Add ITEM at the end of the array, enlarging it by one element.
Mark *LIST as failed if the dynamic array allocation size cannot be Mark *LIST as failed if the dynamic array allocation size cannot be
increased. */ increased. */
__nonnull ((1)) __attribute_nonnull__ ((1))
static inline void static inline void
DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item) DYNARRAY_NAME (add) (struct DYNARRAY_STRUCT *list, DYNARRAY_ELEMENT item)
{ {
@ -348,7 +348,8 @@ DYNARRAY_NAME (emplace__) (struct DYNARRAY_STRUCT *list)
/* Allocate a place for a new element in *LIST and return a pointer to /* Allocate a place for a new element in *LIST and return a pointer to
it. The pointer can be NULL if the dynamic array cannot be it. The pointer can be NULL if the dynamic array cannot be
enlarged due to a memory allocation failure. */ enlarged due to a memory allocation failure. */
__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1)) __attribute_maybe_unused__ __attribute_warn_unused_result__
__attribute_nonnull__ ((1))
static static
/* Avoid inlining with the larger initialization code. */ /* Avoid inlining with the larger initialization code. */
#if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE)) #if !(defined (DYNARRAY_ELEMENT_INIT) || defined (DYNARRAY_ELEMENT_FREE))
@ -372,7 +373,7 @@ DYNARRAY_NAME (emplace) (struct DYNARRAY_STRUCT *list)
existing size, new elements are added (which can be initialized). existing size, new elements are added (which can be initialized).
Otherwise, the list is truncated, and elements are freed. Return Otherwise, the list is truncated, and elements are freed. Return
false on memory allocation failure (and mark *LIST as failed). */ false on memory allocation failure (and mark *LIST as failed). */
__attribute_maybe_unused__ __nonnull ((1)) __attribute_maybe_unused__ __attribute_nonnull__ ((1))
static bool static bool
DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size) DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size)
{ {
@ -417,7 +418,7 @@ DYNARRAY_NAME (resize) (struct DYNARRAY_STRUCT *list, size_t size)
} }
/* Remove the last element of LIST if it is present. */ /* Remove the last element of LIST if it is present. */
__attribute_maybe_unused__ __nonnull ((1)) __attribute_maybe_unused__ __attribute_nonnull__ ((1))
static void static void
DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list) DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list)
{ {
@ -434,7 +435,7 @@ DYNARRAY_NAME (remove_last) (struct DYNARRAY_STRUCT *list)
/* Remove all elements from the list. The elements are freed, but the /* Remove all elements from the list. The elements are freed, but the
list itself is not. */ list itself is not. */
__attribute_maybe_unused__ __nonnull ((1)) __attribute_maybe_unused__ __attribute_nonnull__ ((1))
static void static void
DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list) DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list)
{ {
@ -452,7 +453,8 @@ DYNARRAY_NAME (clear) (struct DYNARRAY_STRUCT *list)
stored in *RESULT if LIST refers to an empty list. On success, the stored in *RESULT if LIST refers to an empty list. On success, the
pointer in *RESULT is heap-allocated and must be deallocated using pointer in *RESULT is heap-allocated and must be deallocated using
free. */ free. */
__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1, 2)) __attribute_maybe_unused__ __attribute_warn_unused_result__
__attribute_nonnull__ ((1, 2))
static bool static bool
DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list,
DYNARRAY_FINAL_TYPE *result) DYNARRAY_FINAL_TYPE *result)
@ -483,7 +485,8 @@ DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list,
have a sentinel at the end). If LENGTHP is not NULL, the array have a sentinel at the end). If LENGTHP is not NULL, the array
length is written to *LENGTHP. *LIST is re-initialized and can be length is written to *LENGTHP. *LIST is re-initialized and can be
reused. */ reused. */
__attribute_maybe_unused__ __attribute_warn_unused_result__ __nonnull ((1)) __attribute_maybe_unused__ __attribute_warn_unused_result__
__attribute_nonnull__ ((1))
static DYNARRAY_ELEMENT * static DYNARRAY_ELEMENT *
DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp) DYNARRAY_NAME (finalize) (struct DYNARRAY_STRUCT *list, size_t *lengthp)
{ {

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -3,22 +3,26 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <libc-config.h>
# include <stdlib.h>
#endif
#include <dynarray.h> #include <dynarray.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
void void
__libc_dynarray_at_failure (size_t size, size_t index) __libc_dynarray_at_failure (size_t size, size_t index)
@ -28,6 +32,7 @@ __libc_dynarray_at_failure (size_t size, size_t index)
__snprintf (buf, sizeof (buf), "Fatal glibc error: " __snprintf (buf, sizeof (buf), "Fatal glibc error: "
"array index %zu not less than array length %zu\n", "array index %zu not less than array length %zu\n",
index, size); index, size);
__libc_fatal (buf);
#else #else
abort (); abort ();
#endif #endif

View file

@ -3,19 +3,23 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <libc-config.h>
#endif
#include <dynarray.h> #include <dynarray.h>
#include <errno.h> #include <errno.h>
#include <intprops.h> #include <intprops.h>

View file

@ -3,19 +3,23 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <libc-config.h>
#endif
#include <dynarray.h> #include <dynarray.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View file

@ -3,19 +3,23 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <libc-config.h>
#endif
#include <dynarray.h> #include <dynarray.h>
#include <errno.h> #include <errno.h>
#include <intprops.h> #include <intprops.h>

View file

@ -3,19 +3,23 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <libc-config.h>
#endif
#include <dynarray.h> #include <dynarray.h>
#include <string.h> #include <string.h>

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -3,16 +3,16 @@
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */

View file

@ -1,106 +0,0 @@
/* Safe automatic memory allocation.
Copyright (C) 2003, 2006-2007, 2009-2021 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003, 2018.
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
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
/* Specification. */
#include "malloca.h"
#include "verify.h"
/* The speed critical point in this file is freea() applied to an alloca()
result: it must be fast, to match the speed of alloca(). The speed of
mmalloca() and freea() in the other case are not critical, because they
are only invoked for big memory sizes.
Here we use a bit in the address as an indicator, an idea by Ondřej Bílka.
malloca() can return three types of pointers:
- Pointers 0 mod 2*sa_alignment_max come from stack allocation.
- Pointers sa_alignment_max mod 2*sa_alignment_max come from heap
allocation.
- NULL comes from a failed heap allocation. */
/* Type for holding very small pointer differences. */
typedef unsigned char small_t;
/* Verify that it is wide enough. */
verify (2 * sa_alignment_max - 1 <= (small_t) -1);
void *
mmalloca (size_t n)
{
#if HAVE_ALLOCA
/* Allocate one more word, used to determine the address to pass to freea(),
and room for the alignment sa_alignment_max mod 2*sa_alignment_max. */
size_t nplus = n + sizeof (small_t) + 2 * sa_alignment_max - 1;
if (nplus >= n)
{
char *mem = (char *) malloc (nplus);
if (mem != NULL)
{
char *p =
(char *)((((uintptr_t)mem + sizeof (small_t) + sa_alignment_max - 1)
& ~(uintptr_t)(2 * sa_alignment_max - 1))
+ sa_alignment_max);
/* Here p >= mem + sizeof (small_t),
and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1
hence p + n <= mem + nplus.
So, the memory range [p, p+n) lies in the allocated memory range
[mem, mem + nplus). */
((small_t *) p)[-1] = p - mem;
/* p ≡ sa_alignment_max mod 2*sa_alignment_max. */
return p;
}
}
/* Out of memory. */
return NULL;
#else
# if !MALLOC_0_IS_NONNULL
if (n == 0)
n = 1;
# endif
return malloc (n);
#endif
}
#if HAVE_ALLOCA
void
freea (void *p)
{
/* Check argument. */
if ((uintptr_t) p & (sa_alignment_max - 1))
{
/* p was not the result of a malloca() call. Invalid argument. */
abort ();
}
/* Determine whether p was a non-NULL pointer returned by mmalloca(). */
if ((uintptr_t) p & sa_alignment_max)
{
void *mem = (char *) p - ((small_t *) p)[-1];
free (mem);
}
}
#endif
/*
* Hey Emacs!
* Local Variables:
* coding: utf-8
* End:
*/

Some files were not shown because too many files have changed in this diff Show more