1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Update Gnulib to v0.0-7509-g98a2286.

* Makefile.am (EXTRA_DIST): Add `m4/gnulib-cache.m4'.
* build-aux/git-version-gen: Keep unchanged.
This commit is contained in:
Ludovic Courtès 2012-07-06 23:25:57 +02:00
parent 32299e49e8
commit 005de2e827
166 changed files with 4361 additions and 1411 deletions

2
.gitignore vendored
View file

@ -148,3 +148,5 @@ INSTALL
/lib/signal.h
/lib/sys/types.h
/lib/dirent.h
/lib/langinfo.h
/lib/wctype.h

View file

@ -20,20 +20,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Systems where /bin/sh is not the default shell need this. The $(shell)
# command below won't work with e.g. stock DOS/Windows shells.
ifeq ($(wildcard /bin/s[h]),/bin/sh)
SHELL = /bin/sh
else
# will be used only with the next shell-test line, then overwritten
# by a configured-in value
SHELL = sh
endif
# If the user runs GNU make but has not yet run ./configure,
# give them a diagnostic.
_have-Makefile := $(shell test -f Makefile && echo yes)
ifeq ($(_have-Makefile),yes)
_gl-Makefile := $(wildcard [M]akefile)
ifneq ($(_gl-Makefile),)
# Make tar archive easier to reproduce.
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner

View file

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in.
##
## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006, 2007,
## 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
## 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
@ -44,6 +44,7 @@ libguileinclude_HEADERS = libguile.h
EXTRA_DIST = LICENSE HACKING GUILE-VERSION \
m4/ChangeLog-2008 \
m4/gnulib-cache.m4 \
ChangeLog-2008 \
.version \
gnulib-local/lib/localcharset.h.diff \

View file

@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0;
# Generate a release announcement message.
my $VERSION = '2012-01-06 07:46'; # UTC
my $VERSION = '2012-06-08 06:53'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@ -30,13 +30,15 @@ use strict;
use Getopt::Long;
use Digest::MD5;
use Digest::SHA1;
eval { require Digest::SHA; }
or eval 'use Digest::SHA1';
use POSIX qw(strftime);
(my $ME = $0) =~ s|.*/||;
my %valid_release_types = map {$_ => 1} qw (alpha beta stable);
my @archive_suffixes = ('tar.gz', 'tar.bz2', 'tar.lzma', 'tar.xz');
my $srcdir = '.';
sub usage ($)
{
@ -51,7 +53,7 @@ sub usage ($)
my @types = sort keys %valid_release_types;
print $STREAM <<EOF;
Usage: $ME [OPTIONS]
Generate an announcement message.
Generate an announcement message. Run this from builddir.
OPTIONS:
@ -66,7 +68,9 @@ These options must be specified:
The following are optional:
--news=NEWS_FILE
--news=NEWS_FILE include the NEWS section about this release
from this NEWS_FILE; accumulates.
--srcdir=DIR where to find the NEWS_FILEs (default: $srcdir)
--bootstrap-tools=TOOL_LIST a comma-separated list of tools, e.g.,
autoconf,automake,bison,gnulib
--gnulib-version=VERSION report VERSION as the gnulib version, where
@ -102,13 +106,13 @@ sub sizes (@)
my %res;
foreach my $f (@file)
{
my $cmd = "du --human $f";
my $cmd = "du -h $f";
my $t = `$cmd`;
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
$@
and (warn "$ME: command failed: '$cmd'\n"), $fail = 1;
and (warn "command failed: '$cmd'\n"), $fail = 1;
chomp $t;
$t =~ s/^([\d.]+[MkK]).*/${1}B/;
$t =~ s/^\s*([\d.]+[MkK]).*/${1}B/;
$res{$f} = $t;
}
return $fail ? undef : %res;
@ -181,7 +185,7 @@ sub print_news_deltas ($$$)
my ($news_file, $prev_version, $curr_version) = @_;
my $news_name = $news_file;
$news_name =~ s|^\./||;
$news_name =~ s|^\Q$srcdir\E/||;
print "\n$news_name\n\n";
@ -310,7 +314,7 @@ sub print_changelog_deltas ($$)
# The exit code should be 1.
# Allow in case there are no modified ChangeLog entries.
$? == 256 || $? == 128
or warn "$ME: warning: '$cmd' had unexpected exit code or signal ($?)\n";
or warn "warning: '$cmd' had unexpected exit code or signal ($?)\n";
}
sub get_tool_versions ($$)
@ -340,7 +344,7 @@ sub get_tool_versions ($$)
{
defined $first_line
and $first_line = '';
warn "$ME: $t: unexpected --version output\n:$first_line";
warn "$t: unexpected --version output\n:$first_line";
$fail = 1;
}
}
@ -368,6 +372,15 @@ sub get_tool_versions ($$)
my $gnulib_version;
my $print_checksums_p = 1;
# Reformat the warnings before displaying them.
local $SIG{__WARN__} = sub
{
my ($msg) = @_;
# Warnings from GetOptions.
$msg =~ s/Option (\w)/option --$1/;
warn "$ME: $msg";
};
GetOptions
(
'mail-headers=s' => \$mail_headers,
@ -378,6 +391,7 @@ sub get_tool_versions ($$)
'gpg-key-id=s' => \$gpg_key_id,
'url-directory=s' => \@url_dir_list,
'news=s' => \@news_file,
'srcdir=s' => \$srcdir,
'bootstrap-tools=s' => \$bootstrap_tools,
'gnulib-version=s' => \$gnulib_version,
'print-checksums!' => \$print_checksums_p,
@ -388,32 +402,32 @@ sub get_tool_versions ($$)
) or usage 1;
my $fail = 0;
# Ensure that sure each required option is specified.
# Ensure that each required option is specified.
$release_type
or (warn "$ME: release type not specified\n"), $fail = 1;
or (warn "release type not specified\n"), $fail = 1;
$package_name
or (warn "$ME: package name not specified\n"), $fail = 1;
or (warn "package name not specified\n"), $fail = 1;
$prev_version
or (warn "$ME: previous version string not specified\n"), $fail = 1;
or (warn "previous version string not specified\n"), $fail = 1;
$curr_version
or (warn "$ME: current version string not specified\n"), $fail = 1;
or (warn "current version string not specified\n"), $fail = 1;
$gpg_key_id
or (warn "$ME: GnuPG key ID not specified\n"), $fail = 1;
or (warn "GnuPG key ID not specified\n"), $fail = 1;
@url_dir_list
or (warn "$ME: URL directory name(s) not specified\n"), $fail = 1;
or (warn "URL directory name(s) not specified\n"), $fail = 1;
my @tool_list = split ',', $bootstrap_tools;
grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
and (warn "$ME: when specifying gnulib as a tool, you must also specify\n"
and (warn "when specifying gnulib as a tool, you must also specify\n"
. "--gnulib-version=V, where V is the result of running git describe\n"
. "in the gnulib source directory.\n"), $fail = 1;
exists $valid_release_types{$release_type}
or (warn "$ME: '$release_type': invalid release type\n"), $fail = 1;
or (warn "'$release_type': invalid release type\n"), $fail = 1;
@ARGV
and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"),
and (warn "too many arguments:\n", join ("\n", @ARGV), "\n"),
$fail = 1;
$fail
and usage 1;

View file

@ -25,7 +25,7 @@
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# All known linkers require a '.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so

View file

@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0;
# Convert git log output to ChangeLog format.
my $VERSION = '2012-01-06 07:14'; # UTC
my $VERSION = '2012-05-22 09:40'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@ -64,12 +64,19 @@ OPTIONS:
makes a change to SHA1's commit log text or metadata.
--append-dot append a dot to the first line of each commit message if
there is no other punctuation or blank at the end.
--no-cluster never cluster commit messages under the same date/author
header; the default is to cluster adjacent commit messages
if their headers are the same and neither commit message
contains multiple paragraphs.
--since=DATE convert only the logs since DATE;
the default is to convert all log entries.
--format=FMT set format string for commit subject and body;
see 'man git-log' for the list of format metacharacters;
the default is '%s%n%b%n'
--strip-tab remove one additional leading TAB from commit message lines.
--strip-cherry-pick remove data inserted by "git cherry-pick";
this includes the "cherry picked from commit ..." line,
and the possible final "Conflicts:" paragraph.
--help display this help and exit
--version output version information and exit
@ -190,6 +197,9 @@ sub parse_amend_file($)
my $format_string = '%s%n%b%n';
my $amend_file;
my $append_dot = 0;
my $cluster = 1;
my $strip_tab = 0;
my $strip_cherry_pick = 0;
GetOptions
(
help => sub { usage 0 },
@ -198,6 +208,9 @@ sub parse_amend_file($)
'format=s' => \$format_string,
'amend=s' => \$amend_file,
'append-dot' => \$append_dot,
'cluster!' => \$cluster,
'strip-tab' => \$strip_tab,
'strip-cherry-pick' => \$strip_cherry_pick,
) or usage 1;
@ -257,6 +270,13 @@ sub parse_amend_file($)
$rest = $_;
}
# Remove lines inserted by "git cherry-pick".
if ($strip_cherry_pick)
{
$rest =~ s/^\s*Conflicts:\n.*//sm;
$rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m;
}
my @line = split "\n", $rest;
my $author_line = shift @line;
defined $author_line
@ -302,13 +322,15 @@ sub parse_amend_file($)
. substr ($_, 5) . "\n";
}
# If this header would be different from the previous date/name/email/
# coauthors header, or if this or the previous entry consists of two
# or more paragraphs, then print the header.
if ($date_line ne $prev_date_line
or "@coauthors" ne "@prev_coauthors"
or $multi_paragraph
or $prev_multi_paragraph)
# If clustering of commit messages has been disabled, if this header
# would be different from the previous date/name/email/coauthors header,
# or if this or the previous entry consists of two or more paragraphs,
# then print the header.
if ( ! $cluster
|| $date_line ne $prev_date_line
|| "@coauthors" ne "@prev_coauthors"
|| $multi_paragraph
|| $prev_multi_paragraph)
{
$prev_date_line eq ''
or print "\n";
@ -339,6 +361,10 @@ sub parse_amend_file($)
}
}
# Remove one additional leading TAB from each line.
$strip_tab
and map { s/^\t// } @line;
# Prefix each non-empty line with a TAB.
@line = map { length $_ ? "\t$_" : '' } @line;

View file

@ -27,30 +27,33 @@ VERSION=2009-07-21.16; # UTC
# Requirements: everything required to bootstrap your package,
# plus these: git, cvs, cvsu, rsync, mktemp
ME=`basename "$0"`
ME=$(basename "$0")
warn() { printf '%s: %s\n' "$ME" "$*" >&2; }
die() { warn "$*"; exit 1; }
help_version()
help()
{
case $1 in
--help) cat <<EOF
cat <<EOF
Usage: $ME
Run this script (no options or arguments) after each non-alpha release,
to update the web documentation at http://www.gnu.org/software/\$pkg/manual/
Run it from your project's the top-level directory.
Run this script from top_srcdir (no options or arguments) after each
non-alpha release, to update the web documentation at
http://www.gnu.org/software/\$pkg/manual/ Run it from your project's
the top-level directory.
Options:
-C, --builddir=DIR location of (configured) Makefile (default: .)
--help print this help, then exit
--version print version number, then exit
Report bugs and patches to <bug-gnulib@gnu.org>.
EOF
exit ;;
exit
}
--version)
year=`echo "$VERSION" | sed 's/[^0-9].*//'`
version()
{
year=$(echo "$VERSION" | sed 's/[^0-9].*//')
cat <<EOF
$ME $VERSION
Copyright (C) $year Free Software Foundation, Inc,
@ -58,28 +61,46 @@ License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
exit ;;
*) die "unrecognized option: $1";;
esac
exit
}
case $# in
0) ;;
1) help_version $1 ;;
*) die "$ME: too many options" ;;
esac
builddir=.
while test $# != 0
do
# Handle --option=value by splitting apart and putting back on argv.
case $1 in
--*=*)
opt=$(echo "$1" | sed -e 's/=.*//')
val=$(echo "$1" | sed -e 's/[^=]*=//')
shift
set dummy "$opt" "$val" ${1+"$@"}; shift
;;
esac
case $1 in
--help|--version) ${1#--};;
-C|--builddir) shift; builddir=$1; shift ;;
--*) die "unrecognized option: $1";;
*) break;;
esac
done
test $# = 0 \
|| die "$ME: too many arguments"
prev=.prev-version
version=$(cat $prev) || die "$ME: no $prev file?"
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' Makefile) || die "$ME: no Makefile?"
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' $builddir/Makefile) \
|| die "$ME: no Makefile?"
tmp_branch=web-doc-$version-$$
current_branch=$(git branch | sed -ne '/^\* /{s///;p;q;}')
cleanup()
{
__st=$?;
__st=$?
rm -rf "$tmp"
git checkout master
git checkout "$current_branch"
git submodule update --recursive
git branch -d $tmp_branch
exit $__st
}
@ -89,15 +110,23 @@ trap 'exit $?' 1 2 13 15
# We must build using sources for which --version reports the
# just-released version number, not some string like 7.6.18-20761.
# That version string propagates into all documentation.
set -e
git checkout -b $tmp_branch v$version
ok=0
./bootstrap && ./configure && make && make web-manual && ok=1
test $ok = 1 || exit 1
git submodule update --recursive
./bootstrap
srcdir=$(pwd)
cd "$builddir"
./config.status --recheck
./config.status
make
make web-manual
cd "$srcdir"
set +e
tmp=$(mktemp -d --tmpdir=. web-doc-update.XXXXXX) || exit 1
tmp=$(mktemp -d web-doc-update.XXXXXX) || exit 1
( cd $tmp \
&& cvs -d $USER@cvs.sv.gnu.org:/webcvs/$pkg co $pkg )
rsync -avP doc/manual/ $tmp/$pkg/manual
rsync -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
(
cd $tmp/$pkg/manual

View file

@ -1,9 +1,9 @@
#!/bin/sh
# Sign files and upload them.
scriptversion=2012-01-15.15; # UTC
scriptversion=2012-06-11.00; # UTC
# Copyright (C) 2004-2010, 2012 Free Software Foundation, Inc.
# Copyright (C) 2004-2012 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -28,6 +28,7 @@ GPG='gpg --batch --no-tty'
conffile=.gnuploadrc
to=
dry_run=false
replace=
symlink_files=
delete_files=
delete_symlinks=
@ -53,8 +54,10 @@ Options:
--to DEST specify one destination for FILES
(multiple --to options are allowed)
--user NAME sign with key NAME
--replace allow replacements of existing files
--symlink-regex[=EXPR] use sed script EXPR to compute symbolic link names
--dry-run do nothing, show what would have been done
(including the constructed directive file)
--version output version information and exit
If --symlink-regex is given without EXPR, then the link target name
@ -146,6 +149,9 @@ while test -n "$1"; do
--delete)
collect_var=delete_files
;;
--replace)
replace="replace: true"
;;
--rmsymlink)
collect_var=delete_symlinks
;;
@ -243,11 +249,13 @@ unset passphrase
# listings with their arguments...).
# Remember this script runs with 'set -e', so if echo is not built-in
# it will exit now.
PATH=/empty echo -n "Enter GPG passphrase: "
stty -echo
read -r passphrase
stty echo
echo
if $dry_run; then :; else
PATH=/empty echo -n "Enter GPG passphrase: "
stty -echo
read -r passphrase
stty echo
echo
fi
if test $# -ne 0; then
for file
@ -270,7 +278,7 @@ filename: $3$stmt"
fi
cat >${2}.directive<<EOF
version: 1.1
version: 1.2
directory: $1
comment: gnupload v. $scriptversion$stmt
EOF
@ -393,6 +401,12 @@ do
do
echo "Uploading $file to $dest ..."
stmt=
#
# allowing file replacement is all or nothing.
if test -n "$replace"; then stmt="$stmt
$replace"
fi
#
files="$file $file.sig"
destdir=`echo $dest | sed 's/[^:]*://'`
if test -n "$symlink_expr"; then

View file

@ -1,4 +1,4 @@
#ifndef _Noreturn
#if !defined _Noreturn && __STDC_VERSION__ < 201112
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|| 0x5110 <= __SUNPRO_C)
# define _Noreturn __attribute__ ((__noreturn__))

View file

@ -3,9 +3,9 @@ information from the environment. See
http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00040.html for the
rationale.
--- a/lib/localcharset.c 2011-12-14 23:10:58.000000000 +0100
+++ b/lib/localcharset.c 2011-12-15 00:45:12.000000000 +0100
@@ -545,3 +545,74 @@ locale_charset (void)
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -544,3 +544,73 @@ locale_charset (void)
return codeset;
}

View file

@ -62,9 +62,11 @@ libgnu_la_LDFLAGS += $(ISNANL_LIBM)
libgnu_la_LDFLAGS += $(LDEXP_LIBM)
libgnu_la_LDFLAGS += $(LIBSOCKET)
libgnu_la_LDFLAGS += $(LOG1P_LIBM)
libgnu_la_LDFLAGS += $(LOG_LIBM)
libgnu_la_LDFLAGS += $(LTLIBICONV)
libgnu_la_LDFLAGS += $(LTLIBINTL)
libgnu_la_LDFLAGS += $(LTLIBUNISTRING)
libgnu_la_LDFLAGS += $(ROUND_LIBM)
libgnu_la_LDFLAGS += $(SERVENT_LIB)
libgnu_la_LDFLAGS += $(TRUNC_LIBM)
@ -279,7 +281,7 @@ configmake.h: Makefile
echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
echo '#define PKGLIBDIR "$(pkglibdir)"'; \
echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
} | sed '/""/d' > $@-t
} | sed '/""/d' > $@-t && \
mv -f $@-t $@
BUILT_SOURCES += configmake.h
@ -911,12 +913,15 @@ locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
-e 's/@''GNULIB_LOCALECONV''@/$(GNULIB_LOCALECONV)/g' \
-e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \
-e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \
-e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
-e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
-e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \
-e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \
-e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
-e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@ -929,6 +934,33 @@ EXTRA_DIST += locale.in.h
## end gnulib module locale
## begin gnulib module localeconv
EXTRA_DIST += localeconv.c
EXTRA_libgnu_la_SOURCES += localeconv.c
## end gnulib module localeconv
## begin gnulib module log
EXTRA_DIST += log.c
EXTRA_libgnu_la_SOURCES += log.c
## end gnulib module log
## begin gnulib module log1p
EXTRA_DIST += log1p.c
EXTRA_libgnu_la_SOURCES += log1p.c
## end gnulib module log1p
## begin gnulib module lstat
@ -991,6 +1023,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_ATANF''@/$(GNULIB_ATANF)/g' \
-e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/g' \
-e 's/@''GNULIB_ATAN2F''@/$(GNULIB_ATAN2F)/g' \
-e 's/@''GNULIB_CBRT''@/$(GNULIB_CBRT)/g' \
-e 's/@''GNULIB_CBRTF''@/$(GNULIB_CBRTF)/g' \
-e 's/@''GNULIB_CBRTL''@/$(GNULIB_CBRTL)/g' \
-e 's/@''GNULIB_CEIL''@/$(GNULIB_CEIL)/g' \
-e 's/@''GNULIB_CEILF''@/$(GNULIB_CEILF)/g' \
-e 's/@''GNULIB_CEILL''@/$(GNULIB_CEILL)/g' \
@ -1002,17 +1037,33 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_COSHF''@/$(GNULIB_COSHF)/g' \
-e 's/@''GNULIB_EXPF''@/$(GNULIB_EXPF)/g' \
-e 's/@''GNULIB_EXPL''@/$(GNULIB_EXPL)/g' \
-e 's/@''GNULIB_EXP2''@/$(GNULIB_EXP2)/g' \
-e 's/@''GNULIB_EXP2F''@/$(GNULIB_EXP2F)/g' \
-e 's/@''GNULIB_EXP2L''@/$(GNULIB_EXP2L)/g' \
-e 's/@''GNULIB_EXPM1''@/$(GNULIB_EXPM1)/g' \
-e 's/@''GNULIB_EXPM1F''@/$(GNULIB_EXPM1F)/g' \
-e 's/@''GNULIB_EXPM1L''@/$(GNULIB_EXPM1L)/g' \
-e 's/@''GNULIB_FABSF''@/$(GNULIB_FABSF)/g' \
-e 's/@''GNULIB_FABSL''@/$(GNULIB_FABSL)/g' \
-e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \
-e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
-e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
-e 's/@''GNULIB_FMA''@/$(GNULIB_FMA)/g' \
-e 's/@''GNULIB_FMAF''@/$(GNULIB_FMAF)/g' \
-e 's/@''GNULIB_FMAL''@/$(GNULIB_FMAL)/g' \
-e 's/@''GNULIB_FMOD''@/$(GNULIB_FMOD)/g' \
-e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
-e 's/@''GNULIB_FMODL''@/$(GNULIB_FMODL)/g' \
-e 's/@''GNULIB_FREXPF''@/$(GNULIB_FREXPF)/g' \
-e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \
-e 's/@''GNULIB_FREXPL''@/$(GNULIB_FREXPL)/g' \
-e 's/@''GNULIB_HYPOT''@/$(GNULIB_HYPOT)/g' \
-e 's/@''GNULIB_HYPOTF''@/$(GNULIB_HYPOTF)/g' \
-e 's/@''GNULIB_HYPOTL''@/$(GNULIB_HYPOTL)/g' \
< $(srcdir)/math.in.h | \
sed -e 's/@''GNULIB_ILOGB''@/$(GNULIB_ILOGB)/g' \
-e 's/@''GNULIB_ILOGBF''@/$(GNULIB_ILOGBF)/g' \
-e 's/@''GNULIB_ILOGBL''@/$(GNULIB_ILOGBL)/g' \
-e 's/@''GNULIB_ISFINITE''@/$(GNULIB_ISFINITE)/g' \
-e 's/@''GNULIB_ISINF''@/$(GNULIB_ISINF)/g' \
-e 's/@''GNULIB_ISNAN''@/$(GNULIB_ISNAN)/g' \
@ -1021,12 +1072,28 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_ISNANL''@/$(GNULIB_ISNANL)/g' \
-e 's/@''GNULIB_LDEXPF''@/$(GNULIB_LDEXPF)/g' \
-e 's/@''GNULIB_LDEXPL''@/$(GNULIB_LDEXPL)/g' \
-e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
-e 's/@''GNULIB_LOG''@/$(GNULIB_LOG)/g' \
-e 's/@''GNULIB_LOGF''@/$(GNULIB_LOGF)/g' \
-e 's/@''GNULIB_LOGL''@/$(GNULIB_LOGL)/g' \
-e 's/@''GNULIB_LOG10''@/$(GNULIB_LOG10)/g' \
-e 's/@''GNULIB_LOG10F''@/$(GNULIB_LOG10F)/g' \
-e 's/@''GNULIB_LOG10L''@/$(GNULIB_LOG10L)/g' \
-e 's/@''GNULIB_LOG1P''@/$(GNULIB_LOG1P)/g' \
-e 's/@''GNULIB_LOG1PF''@/$(GNULIB_LOG1PF)/g' \
-e 's/@''GNULIB_LOG1PL''@/$(GNULIB_LOG1PL)/g' \
-e 's/@''GNULIB_LOG2''@/$(GNULIB_LOG2)/g' \
-e 's/@''GNULIB_LOG2F''@/$(GNULIB_LOG2F)/g' \
-e 's/@''GNULIB_LOG2L''@/$(GNULIB_LOG2L)/g' \
-e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
-e 's/@''GNULIB_LOGBF''@/$(GNULIB_LOGBF)/g' \
-e 's/@''GNULIB_LOGBL''@/$(GNULIB_LOGBL)/g' \
-e 's/@''GNULIB_MODF''@/$(GNULIB_MODF)/g' \
-e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
-e 's/@''GNULIB_MODFL''@/$(GNULIB_MODFL)/g' \
-e 's/@''GNULIB_POWF''@/$(GNULIB_POWF)/g' \
-e 's/@''GNULIB_REMAINDER''@/$(GNULIB_REMAINDER)/g' \
-e 's/@''GNULIB_REMAINDERF''@/$(GNULIB_REMAINDERF)/g' \
-e 's/@''GNULIB_REMAINDERL''@/$(GNULIB_REMAINDERL)/g' \
-e 's/@''GNULIB_RINT''@/$(GNULIB_RINT)/g' \
-e 's/@''GNULIB_RINTF''@/$(GNULIB_RINTF)/g' \
-e 's/@''GNULIB_RINTL''@/$(GNULIB_RINTL)/g' \
@ -1045,7 +1112,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
-e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
-e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
< $(srcdir)/math.in.h | \
| \
sed -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \
-e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
-e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \
@ -1053,20 +1120,31 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_ATANF''@|$(HAVE_ATANF)|g' \
-e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
-e 's|@''HAVE_ATAN2F''@|$(HAVE_ATAN2F)|g' \
-e 's|@''HAVE_CBRT''@|$(HAVE_CBRT)|g' \
-e 's|@''HAVE_CBRTF''@|$(HAVE_CBRTF)|g' \
-e 's|@''HAVE_CBRTL''@|$(HAVE_CBRTL)|g' \
-e 's|@''HAVE_COPYSIGN''@|$(HAVE_COPYSIGN)|g' \
-e 's|@''HAVE_COPYSIGNF''@|$(HAVE_COPYSIGNF)|g' \
-e 's|@''HAVE_COPYSIGNL''@|$(HAVE_COPYSIGNL)|g' \
-e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \
-e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
-e 's|@''HAVE_COSHF''@|$(HAVE_COSHF)|g' \
-e 's|@''HAVE_EXPF''@|$(HAVE_EXPF)|g' \
-e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
-e 's|@''HAVE_EXPM1''@|$(HAVE_EXPM1)|g' \
-e 's|@''HAVE_EXPM1F''@|$(HAVE_EXPM1F)|g' \
-e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
-e 's|@''HAVE_FABSL''@|$(HAVE_FABSL)|g' \
-e 's|@''HAVE_FMA''@|$(HAVE_FMA)|g' \
-e 's|@''HAVE_FMAF''@|$(HAVE_FMAF)|g' \
-e 's|@''HAVE_FMAL''@|$(HAVE_FMAL)|g' \
-e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \
-e 's|@''HAVE_FMODL''@|$(HAVE_FMODL)|g' \
-e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|g' \
-e 's|@''HAVE_HYPOTF''@|$(HAVE_HYPOTF)|g' \
-e 's|@''HAVE_HYPOTL''@|$(HAVE_HYPOTL)|g' \
-e 's|@''HAVE_ILOGB''@|$(HAVE_ILOGB)|g' \
-e 's|@''HAVE_ILOGBF''@|$(HAVE_ILOGBF)|g' \
-e 's|@''HAVE_ILOGBL''@|$(HAVE_ILOGBL)|g' \
-e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
-e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
-e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
@ -1074,10 +1152,18 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_LOGF''@|$(HAVE_LOGF)|g' \
-e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
-e 's|@''HAVE_LOG10F''@|$(HAVE_LOG10F)|g' \
-e 's|@''HAVE_LOG10L''@|$(HAVE_LOG10L)|g' \
-e 's|@''HAVE_LOG1P''@|$(HAVE_LOG1P)|g' \
-e 's|@''HAVE_LOG1PF''@|$(HAVE_LOG1PF)|g' \
-e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \
-e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \
-e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \
-e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
-e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
-e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
-e 's|@''HAVE_REMAINDER''@|$(HAVE_REMAINDER)|g' \
-e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \
-e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \
-e 's|@''HAVE_RINTF''@|$(HAVE_RINTF)|g' \
-e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \
-e 's|@''HAVE_SINF''@|$(HAVE_SINF)|g' \
-e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
@ -1090,16 +1176,30 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
-e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
-e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
-e 's|@''HAVE_DECL_CBRTF''@|$(HAVE_DECL_CBRTF)|g' \
-e 's|@''HAVE_DECL_CBRTL''@|$(HAVE_DECL_CBRTL)|g' \
-e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \
-e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
-e 's|@''HAVE_DECL_COPYSIGNF''@|$(HAVE_DECL_COPYSIGNF)|g' \
-e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
-e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
-e 's|@''HAVE_DECL_EXP2''@|$(HAVE_DECL_EXP2)|g' \
-e 's|@''HAVE_DECL_EXP2F''@|$(HAVE_DECL_EXP2F)|g' \
-e 's|@''HAVE_DECL_EXP2L''@|$(HAVE_DECL_EXP2L)|g' \
-e 's|@''HAVE_DECL_EXPM1L''@|$(HAVE_DECL_EXPM1L)|g' \
-e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \
-e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
-e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
-e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
-e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
-e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
-e 's|@''HAVE_DECL_LOG10L''@|$(HAVE_DECL_LOG10L)|g' \
-e 's|@''HAVE_DECL_LOG2''@|$(HAVE_DECL_LOG2)|g' \
-e 's|@''HAVE_DECL_LOG2F''@|$(HAVE_DECL_LOG2F)|g' \
-e 's|@''HAVE_DECL_LOG2L''@|$(HAVE_DECL_LOG2L)|g' \
-e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
-e 's|@''HAVE_DECL_REMAINDER''@|$(HAVE_DECL_REMAINDER)|g' \
-e 's|@''HAVE_DECL_REMAINDERL''@|$(HAVE_DECL_REMAINDERL)|g' \
-e 's|@''HAVE_DECL_RINTF''@|$(HAVE_DECL_RINTF)|g' \
-e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \
-e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \
-e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \
@ -1110,30 +1210,67 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
-e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
| \
sed -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \
sed -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \
-e 's|@''REPLACE_CBRTL''@|$(REPLACE_CBRTL)|g' \
-e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \
-e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
-e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
-e 's|@''REPLACE_EXPM1''@|$(REPLACE_EXPM1)|g' \
-e 's|@''REPLACE_EXPM1F''@|$(REPLACE_EXPM1F)|g' \
-e 's|@''REPLACE_EXP2''@|$(REPLACE_EXP2)|g' \
-e 's|@''REPLACE_EXP2L''@|$(REPLACE_EXP2L)|g' \
-e 's|@''REPLACE_FABSL''@|$(REPLACE_FABSL)|g' \
-e 's|@''REPLACE_FLOOR''@|$(REPLACE_FLOOR)|g' \
-e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
-e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \
-e 's|@''REPLACE_FMA''@|$(REPLACE_FMA)|g' \
-e 's|@''REPLACE_FMAF''@|$(REPLACE_FMAF)|g' \
-e 's|@''REPLACE_FMAL''@|$(REPLACE_FMAL)|g' \
-e 's|@''REPLACE_FMOD''@|$(REPLACE_FMOD)|g' \
-e 's|@''REPLACE_FMODF''@|$(REPLACE_FMODF)|g' \
-e 's|@''REPLACE_FMODL''@|$(REPLACE_FMODL)|g' \
-e 's|@''REPLACE_FREXPF''@|$(REPLACE_FREXPF)|g' \
-e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
-e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
-e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \
-e 's|@''REPLACE_HYPOT''@|$(REPLACE_HYPOT)|g' \
-e 's|@''REPLACE_HYPOTF''@|$(REPLACE_HYPOTF)|g' \
-e 's|@''REPLACE_HYPOTL''@|$(REPLACE_HYPOTL)|g' \
-e 's|@''REPLACE_ILOGB''@|$(REPLACE_ILOGB)|g' \
-e 's|@''REPLACE_ILOGBF''@|$(REPLACE_ILOGBF)|g' \
-e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \
-e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \
-e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \
-e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \
-e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \
-e 's|@''REPLACE_LOG''@|$(REPLACE_LOG)|g' \
-e 's|@''REPLACE_LOGF''@|$(REPLACE_LOGF)|g' \
-e 's|@''REPLACE_LOGL''@|$(REPLACE_LOGL)|g' \
-e 's|@''REPLACE_LOG10''@|$(REPLACE_LOG10)|g' \
-e 's|@''REPLACE_LOG10F''@|$(REPLACE_LOG10F)|g' \
-e 's|@''REPLACE_LOG10L''@|$(REPLACE_LOG10L)|g' \
-e 's|@''REPLACE_LOG1P''@|$(REPLACE_LOG1P)|g' \
-e 's|@''REPLACE_LOG1PF''@|$(REPLACE_LOG1PF)|g' \
-e 's|@''REPLACE_LOG1PL''@|$(REPLACE_LOG1PL)|g' \
-e 's|@''REPLACE_LOG2''@|$(REPLACE_LOG2)|g' \
-e 's|@''REPLACE_LOG2F''@|$(REPLACE_LOG2F)|g' \
-e 's|@''REPLACE_LOG2L''@|$(REPLACE_LOG2L)|g' \
-e 's|@''REPLACE_LOGB''@|$(REPLACE_LOGB)|g' \
-e 's|@''REPLACE_LOGBF''@|$(REPLACE_LOGBF)|g' \
-e 's|@''REPLACE_LOGBL''@|$(REPLACE_LOGBL)|g' \
-e 's|@''REPLACE_MODF''@|$(REPLACE_MODF)|g' \
-e 's|@''REPLACE_MODFF''@|$(REPLACE_MODFF)|g' \
-e 's|@''REPLACE_MODFL''@|$(REPLACE_MODFL)|g' \
-e 's|@''REPLACE_NAN''@|$(REPLACE_NAN)|g' \
-e 's|@''REPLACE_REMAINDER''@|$(REPLACE_REMAINDER)|g' \
-e 's|@''REPLACE_REMAINDERF''@|$(REPLACE_REMAINDERF)|g' \
-e 's|@''REPLACE_REMAINDERL''@|$(REPLACE_REMAINDERL)|g' \
-e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \
-e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \
-e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \
-e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
-e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
-e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \
-e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \
-e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \
-e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
@ -1387,6 +1524,15 @@ EXTRA_libgnu_la_SOURCES += rmdir.c
## end gnulib module rmdir
## begin gnulib module round
EXTRA_DIST += round.c
EXTRA_libgnu_la_SOURCES += round.c
## end gnulib module round
## begin gnulib module safe-read
libgnu_la_SOURCES += safe-read.c
@ -1817,7 +1963,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
-e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
-e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
-e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
-e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
-e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
-e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
@ -2008,15 +2153,6 @@ EXTRA_DIST += stdlib.in.h
## end gnulib module stdlib
## begin gnulib module strcase
EXTRA_DIST += strcasecmp.c strncasecmp.c
EXTRA_libgnu_la_SOURCES += strcasecmp.c strncasecmp.c
## end gnulib module strcase
## begin gnulib module streq
@ -2143,37 +2279,6 @@ EXTRA_DIST += string.in.h
## end gnulib module string
## begin gnulib module strings
BUILT_SOURCES += strings.h
# We need the following in order to create <strings.h> when the system
# doesn't have one that works with the given compiler.
strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
-e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
-e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \
-e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/strings.in.h; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += strings.h strings.h-t
EXTRA_DIST += strings.in.h
## end gnulib module strings
## begin gnulib module sys_file
BUILT_SOURCES += sys/file.h
@ -2269,6 +2374,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
-e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
-e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
-e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
@ -2336,6 +2442,7 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
-e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
-e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@ -2363,6 +2470,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
-e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
< $(srcdir)/sys_types.in.h; \
} > $@-t && \
mv $@-t $@
@ -2473,6 +2581,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
-e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
-e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
-e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
@ -2571,6 +2680,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
-e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
-e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
-e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _ALIGNOF_H
#define _ALIGNOF_H

View file

@ -14,9 +14,9 @@
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
License along with this program; if not, see
<http://www.gnu.org/licenses/>.
*/
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
means there is a real alloca function. */
@ -44,6 +44,13 @@
# define alloca _alloca
# elif defined __DECC && defined __VMS
# define alloca __ALLOCA
# elif defined __TANDEM && defined _TNS_E_TARGET
# ifdef __cplusplus
extern "C"
# endif
void *_alloca (unsigned short);
# pragma intrinsic (_alloca)
# define alloca _alloca
# else
# include <stddef.h>
# ifdef __cplusplus

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ARPA_INET_H

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -25,28 +25,41 @@
so we include it here first. */
#include <stdio.h>
/* SET_BINARY (fd);
changes the file descriptor fd to perform binary I/O. */
/* set_binary_mode (fd, mode)
sets the binary/text I/O mode of file descriptor fd to the given mode
(must be O_BINARY or O_TEXT) and returns the previous mode. */
#if O_BINARY
# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
# include <io.h> /* declares setmode() */
# define set_binary_mode setmode
# else
# define setmode _setmode
# define set_binary_mode _setmode
# undef fileno
# define fileno _fileno
# endif
# ifdef __DJGPP__
#else
/* On reasonable systems, binary I/O is the only choice. */
/* Use an inline function rather than a macro, to avoid gcc warnings
"warning: statement with no effect". */
static inline int
set_binary_mode (int fd, int mode)
{
(void) fd;
(void) mode;
return O_BINARY;
}
#endif
/* SET_BINARY (fd);
changes the file descriptor fd to perform binary I/O. */
#ifdef __DJGPP__
# include <unistd.h> /* declares isatty() */
/* Avoid putting stdin/stdout in binary mode if it is connected to
the console, because that would make it impossible for the user
to interrupt the program through Ctrl-C or Ctrl-Break. */
# define SET_BINARY(fd) ((void) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0))
# else
# define SET_BINARY(fd) ((void) setmode (fd, O_BINARY))
# endif
# define SET_BINARY(fd) ((void) (!isatty (fd) ? (set_binary_mode (fd, O_BINARY), 0) : 0))
#else
/* On reasonable systems, binary I/O is the default. */
# define SET_BINARY(fd) /* do nothing */ ((void) 0)
# define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY))
#endif
#endif /* _BINARY_H */

View file

@ -13,8 +13,7 @@ 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -18,8 +18,7 @@ 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef C_CTYPE_H
#define C_CTYPE_H

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef C_STRCASE_H
#define C_STRCASE_H

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -156,8 +156,12 @@ __realpath (const char *name, char *resolved)
{
rpath[0] = '/';
dest = rpath + 1;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && name[1] == '/')
if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
{
if (name[1] == '/' && name[2] != '/')
*dest++ = '/';
*dest = '\0';
}
}
for (start = end = name; *start; start = end)
@ -187,7 +191,7 @@ __realpath (const char *name, char *resolved)
if (dest > rpath + 1)
while ((--dest)[-1] != '/');
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
&& *dest == '/')
&& *dest == '/' && dest[1] != '/')
dest++;
}
else
@ -298,8 +302,12 @@ __realpath (const char *name, char *resolved)
if (buf[0] == '/')
{
dest = rpath + 1; /* It's an absolute symlink */
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && buf[1] == '/')
if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
{
if (buf[1] == '/' && buf[2] != '/')
*dest++ = '/';
*dest = '\0';
}
}
else
{
@ -308,7 +316,7 @@ __realpath (const char *name, char *resolved)
if (dest > rpath + 1)
while ((--dest)[-1] != '/');
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
&& *dest == '/')
&& *dest == '/' && dest[1] != '/')
dest++;
}
}
@ -321,7 +329,8 @@ __realpath (const char *name, char *resolved)
}
if (dest > rpath + 1 && dest[-1] == '/')
--dest;
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1 && *dest == '/')
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
&& *dest == '/' && dest[1] != '/')
dest++;
*dest = '\0';

View file

@ -54,6 +54,12 @@
# define MINUS_ZERO L_(-0.0)
#endif
/* MSVC with option -fp:strict refuses to compile constant initializers that
contain floating-point operations. Pacify this compiler. */
#ifdef _MSC_VER
# pragma fenv_access (off)
#endif
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.

View file

@ -14,8 +14,7 @@
# 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, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# with this program; if not, see <http://www.gnu.org/licenses/>.
#
# The table consists of lines of the form
# ALIAS CANONICAL
@ -30,7 +29,7 @@
# The current list of GNU canonical charset names is as follows.
#
# name MIME? used by which systems
# (darwin = MacOS X, woe32 = native Windows)
# (darwin = Mac OS X, woe32 = native Windows)
#
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin cygwin
# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin

View file

@ -55,6 +55,14 @@ typedef struct gl_directory DIR;
# endif
#endif
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
# define _GL_ATTRIBUTE_PURE /* empty */
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
@ -229,6 +237,7 @@ _GL_WARN_ON_USE (scandir, "scandir is unportable - "
# if !@HAVE_ALPHASORT@
_GL_FUNCDECL_SYS (alphasort, int,
(const struct dirent **, const struct dirent **)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
# endif
/* Need to cast, because on glibc systems, the parameters are

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ERRNO_H
@ -85,6 +84,16 @@
# define GNULIB_defined_ECANCELED 1
# endif
# ifndef EOWNERDEAD
# define EOWNERDEAD 133
# define GNULIB_defined_EOWNERDEAD 1
# endif
# ifndef ENOTRECOVERABLE
# define ENOTRECOVERABLE 127
# define GNULIB_defined_ENOTRECOVERABLE 1
# endif
# ifndef EINPROGRESS
# define EINPROGRESS 112
# define EALREADY 103
@ -109,15 +118,17 @@
# define ELOOP 114
# define EHOSTUNREACH 110
# define EWOULDBLOCK 140
# define GNULIB_defined_ESOCK 1
# endif
# ifndef ETXTBSY
# define ETXTBSY 139
# define ENODATA 120 /* not required by POSIX */
# define ENOSR 124 /* not required by POSIX */
# define ENOSTR 125 /* not required by POSIX */
# define ENOTRECOVERABLE 127 /* not required by POSIX */
# define EOWNERDEAD 133 /* not required by POSIX */
# define ETIME 137 /* not required by POSIX */
# define EOTHER 131 /* not required by POSIX */
# define GNULIB_defined_ESOCK 1
# define GNULIB_defined_ESTREAMS 1
# endif
/* These are intentionally the same values as the WSA* error numbers, defined
@ -228,6 +239,36 @@
# define GNULIB_defined_ECANCELED 1
# endif
/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
defined. */
# ifndef EOWNERDEAD
# if defined __sun
/* Use the same values as defined for Solaris >= 8, for
interoperability. */
# define EOWNERDEAD 58
# define ENOTRECOVERABLE 59
# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* We have a conflict here: pthreads-win32 defines these values
differently than MSVC 10. It's hairy to decide which one to use. */
# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
/* Use the same values as defined by pthreads-win32, for
interoperability. */
# define EOWNERDEAD 43
# define ENOTRECOVERABLE 44
# else
/* Use the same values as defined by MSVC 10, for
interoperability. */
# define EOWNERDEAD 133
# define ENOTRECOVERABLE 127
# endif
# else
# define EOWNERDEAD 2013
# define ENOTRECOVERABLE 2014
# endif
# define GNULIB_defined_EOWNERDEAD 1
# define GNULIB_defined_ENOTRECOVERABLE 1
# endif
#endif /* _@GUARD_PREFIX@_ERRNO_H */
#endif /* _@GUARD_PREFIX@_ERRNO_H */

View file

@ -25,6 +25,8 @@
#if defined __need_system_fcntl_h
/* Special invocation convention. */
/* Needed before <sys/stat.h>.
May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
@ -42,6 +44,8 @@
#ifndef _@GUARD_PREFIX@_FCNTL_H
/* Needed before <sys/stat.h>.
May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution.

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _FLOATPLUS_H
#define _FLOATPLUS_H

View file

@ -42,6 +42,12 @@
# define L_(literal) literal##f
#endif
/* MSVC with option -fp:strict refuses to compile constant initializers that
contain floating-point operations. Pacify this compiler. */
#ifdef _MSC_VER
# pragma fenv_access (off)
#endif
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.

View file

@ -23,6 +23,12 @@
/* Get the original definition of fstat. It might be defined as a macro. */
#include <sys/types.h>
#include <sys/stat.h>
#if _GL_WINDOWS_64_BIT_ST_SIZE
# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
# define stat _stati64
# undef fstat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
# define fstat _fstati64
#endif
#undef __need_system_sys_stat_h
static inline int

View file

@ -14,8 +14,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <config.h>

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ICONV_H

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
@ -57,7 +56,7 @@ rpl_iconv_open (const char *tocode, const char *fromcode)
iconv() to these encoding inserts a BOM, which is wrong.
We do not need to handle conversion between arbitrary encodings and
UTF-{16,32}{BE,LE}, because the 'striconveh' module implements two-step
conversion throough UTF-8.
conversion through UTF-8.
The _ICONV_* constants are chosen to be disjoint from any iconv_t
returned by the system's iconv_open() functions. Recall that iconv_t
is a scalar type. */

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff <blp@gnu.org>, 2008. */

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* POSIX <langinfo.h> for platforms that lack it or have an incomplete one.

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>. */
@ -30,7 +29,7 @@
#include <stdlib.h>
#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
# define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */
#endif
#if defined _WIN32 || defined __WIN32__

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _LOCALCHARSET_H
#define _LOCALCHARSET_H

View file

@ -30,7 +30,7 @@
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
/* MacOS X 10.5 defines the locale_t type in <xlocale.h>. */
/* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */
#if @HAVE_XLOCALE_H@
# include <xlocale.h>
#endif
@ -47,6 +47,111 @@
# define LC_MESSAGES 1729
#endif
/* Bionic libc's 'struct lconv' is just a dummy. */
#if @REPLACE_STRUCT_LCONV@
# define lconv rpl_lconv
struct lconv
{
/* All 'char *' are actually 'const char *'. */
/* Members that depend on the LC_NUMERIC category of the locale. See
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
/* Symbol used as decimal point. */
char *decimal_point;
/* Symbol used to separate groups of digits to the left of the decimal
point. */
char *thousands_sep;
/* Definition of the size of groups of digits to the left of the decimal
point. */
char *grouping;
/* Members that depend on the LC_MONETARY category of the locale. See
<http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
/* Symbol used as decimal point. */
char *mon_decimal_point;
/* Symbol used to separate groups of digits to the left of the decimal
point. */
char *mon_thousands_sep;
/* Definition of the size of groups of digits to the left of the decimal
point. */
char *mon_grouping;
/* Sign used to indicate a value >= 0. */
char *positive_sign;
/* Sign used to indicate a value < 0. */
char *negative_sign;
/* For formatting local currency. */
/* Currency symbol (3 characters) followed by separator (1 character). */
char *currency_symbol;
/* Number of digits after the decimal point. */
char frac_digits;
/* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
comes after the number. */
char p_cs_precedes;
/* For values >= 0: Position of the sign. */
char p_sign_posn;
/* For values >= 0: Placement of spaces between currency symbol, sign, and
number. */
char p_sep_by_space;
/* For values < 0: 1 if the currency symbol precedes the number, 0 if it
comes after the number. */
char n_cs_precedes;
/* For values < 0: Position of the sign. */
char n_sign_posn;
/* For values < 0: Placement of spaces between currency symbol, sign, and
number. */
char n_sep_by_space;
/* For formatting international currency. */
/* Currency symbol (3 characters) followed by separator (1 character). */
char *int_curr_symbol;
/* Number of digits after the decimal point. */
char int_frac_digits;
/* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
comes after the number. */
char int_p_cs_precedes;
/* For values >= 0: Position of the sign. */
char int_p_sign_posn;
/* For values >= 0: Placement of spaces between currency symbol, sign, and
number. */
char int_p_sep_by_space;
/* For values < 0: 1 if the currency symbol precedes the number, 0 if it
comes after the number. */
char int_n_cs_precedes;
/* For values < 0: Position of the sign. */
char int_n_sign_posn;
/* For values < 0: Placement of spaces between currency symbol, sign, and
number. */
char int_n_sep_by_space;
};
#endif
#if @GNULIB_LOCALECONV@
# if @REPLACE_LOCALECONV@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef localeconv
# define localeconv rpl_localeconv
# endif
_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
# else
_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
# endif
_GL_CXXALIASWARN (localeconv);
#elif @REPLACE_STRUCT_LCONV@
# undef localeconv
# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
#elif defined GNULIB_POSIXCHECK
# undef localeconv
# if HAVE_RAW_DECL_LOCALECONV
_GL_WARN_ON_USE (localeconv,
"localeconv returns too few information on some platforms - "
"use gnulib module localeconv for portability");
# endif
#endif
#if @GNULIB_SETLOCALE@
# if @REPLACE_SETLOCALE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)

103
lib/localeconv.c Normal file
View file

@ -0,0 +1,103 @@
/* Query locale dependent information for formatting numbers.
Copyright (C) 2012 Free Software Foundation, Inc.
This program 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 3 of the License, 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 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 <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <locale.h>
#if HAVE_STRUCT_LCONV_DECIMAL_POINT
/* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_*
members. */
struct lconv *
localeconv (void)
{
static struct lconv result;
# undef lconv
# undef localeconv
struct lconv *sys_result = localeconv ();
result.decimal_point = sys_result->decimal_point;
result.thousands_sep = sys_result->thousands_sep;
result.grouping = sys_result->grouping;
result.mon_decimal_point = sys_result->mon_decimal_point;
result.mon_thousands_sep = sys_result->mon_thousands_sep;
result.mon_grouping = sys_result->mon_grouping;
result.positive_sign = sys_result->positive_sign;
result.negative_sign = sys_result->negative_sign;
result.currency_symbol = sys_result->currency_symbol;
result.frac_digits = sys_result->frac_digits;
result.p_cs_precedes = sys_result->p_cs_precedes;
result.p_sign_posn = sys_result->p_sign_posn;
result.p_sep_by_space = sys_result->p_sep_by_space;
result.n_cs_precedes = sys_result->n_cs_precedes;
result.n_sign_posn = sys_result->n_sign_posn;
result.n_sep_by_space = sys_result->n_sep_by_space;
result.int_curr_symbol = sys_result->int_curr_symbol;
result.int_frac_digits = sys_result->int_frac_digits;
result.int_p_cs_precedes = sys_result->p_cs_precedes;
result.int_p_sign_posn = sys_result->p_sign_posn;
result.int_p_sep_by_space = sys_result->p_sep_by_space;
result.int_n_cs_precedes = sys_result->n_cs_precedes;
result.int_n_sign_posn = sys_result->n_sign_posn;
result.int_n_sep_by_space = sys_result->n_sep_by_space;
return &result;
}
#else
/* Override for platforms where 'struct lconv' is a dummy. */
# include <limits.h>
struct lconv *
localeconv (void)
{
static /*const*/ struct lconv result =
{
/* decimal_point */ ".",
/* thousands_sep */ "",
/* grouping */ "",
/* mon_decimal_point */ "",
/* mon_thousands_sep */ "",
/* mon_grouping */ "",
/* positive_sign */ "",
/* negative_sign */ "",
/* currency_symbol */ "",
/* frac_digits */ CHAR_MAX,
/* p_cs_precedes */ CHAR_MAX,
/* p_sign_posn */ CHAR_MAX,
/* p_sep_by_space */ CHAR_MAX,
/* n_cs_precedes */ CHAR_MAX,
/* n_sign_posn */ CHAR_MAX,
/* n_sep_by_space */ CHAR_MAX,
/* int_curr_symbol */ "",
/* int_frac_digits */ CHAR_MAX,
/* int_p_cs_precedes */ CHAR_MAX,
/* int_p_sign_posn */ CHAR_MAX,
/* int_p_sep_by_space */ CHAR_MAX,
/* int_n_cs_precedes */ CHAR_MAX,
/* int_n_sign_posn */ CHAR_MAX,
/* int_n_sep_by_space */ CHAR_MAX
};
return &result;
}
#endif

38
lib/log.c Normal file
View file

@ -0,0 +1,38 @@
/* Logarithm.
Copyright (C) 2012 Free Software Foundation, Inc.
This program 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 3 of the License, 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 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 <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <math.h>
double
log (double x)
#undef log
{
if (x <= 0.0)
{
/* Work around the OSF/1 5.1 bug. */
if (x == 0.0)
/* Return -Infinity. */
return -1.0 / 0.0;
/* Work around the NetBSD 5.1, Solaris 11 2011-11 bug. */
else /* x < 0.0 */
/* Return NaN. */
return 0.0 / 0.0;
}
return log (x);
}

518
lib/log1p.c Normal file
View file

@ -0,0 +1,518 @@
/* Natural logarithm of 1 plus argument.
Copyright (C) 2012 Free Software Foundation, Inc.
This program 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 3 of the License, 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 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 <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <math.h>
double
log1p (double x)
{
if (isnand (x))
return x;
if (x <= -1.0)
{
if (x == -1.0)
/* Return -Infinity. */
return - HUGE_VAL;
else
{
/* Return NaN. */
#if defined _MSC_VER || (defined __sgi && !defined __GNUC__)
static double zero;
return zero / zero;
#else
return 0.0 / 0.0;
#endif
}
}
if (x < -0.5 || x > 1.0)
return log (1.0 + x);
/* Here -0.5 <= x <= 1.0. */
if (x == 0.0)
/* Return a zero with the same sign as x. */
return x;
/* Decompose x into
1 + x = (1 + m/256) * (1 + y)
where
m is an integer, -128 <= m <= 256,
y is a number, |y| <= 1/256.
y is computed as
y = (256 * x - m) / (256 + m).
Then
log(1+x) = log(m/256) + log(1+y)
The first summand is a table lookup.
The second summand is computed
- either through the power series
log(1+y) = y
- 1/2 * y^2
+ 1/3 * y^3
- 1/4 * y^4
+ 1/5 * y^5
- 1/6 * y^6
+ 1/7 * y^7
- 1/8 * y^8
+ 1/9 * y^9
- 1/10 * y^10
+ 1/11 * y^11
- 1/12 * y^12
+ 1/13 * y^13
- 1/14 * y^14
+ 1/15 * y^15
- ...
- or as log(1+y) = log((1+z)/(1-z)) = 2 * atanh(z)
where z = y/(2+y)
and atanh(z) is computed through its power series:
atanh(z) = z
+ 1/3 * z^3
+ 1/5 * z^5
+ 1/7 * z^7
+ 1/9 * z^9
+ 1/11 * z^11
+ 1/13 * z^13
+ 1/15 * z^15
+ ...
Since |z| <= 1/511 < 0.002, the relative contribution of the z^9
term is < 1/9*0.002^8 < 2^-60 <= 2^-DBL_MANT_DIG, therefore we
can truncate the series after the z^7 term. */
{
double m = round (x * 256.0);
double y = ((x * 256.0) - m) / (m + 256.0);
double z = y / (2.0 + y);
/* Coefficients of the power series for atanh(z). */
#define ATANH_COEFF_1 1.0
#define ATANH_COEFF_3 0.333333333333333333333333333333333333334
#define ATANH_COEFF_5 0.2
#define ATANH_COEFF_7 0.142857142857142857142857142857142857143
#define ATANH_COEFF_9 0.1111111111111111111111111111111111111113
#define ATANH_COEFF_11 0.090909090909090909090909090909090909091
#define ATANH_COEFF_13 0.076923076923076923076923076923076923077
#define ATANH_COEFF_15 0.066666666666666666666666666666666666667
double z2 = z * z;
double atanh_z =
(((ATANH_COEFF_7
* z2 + ATANH_COEFF_5)
* z2 + ATANH_COEFF_3)
* z2 + ATANH_COEFF_1)
* z;
/* log_table[i] = log((i + 128) / 256).
Computed in GNU clisp through
(setf (long-float-digits) 128)
(setq a 0L0)
(setf (long-float-digits) 256)
(dotimes (i 385)
(format t " ~D,~%"
(float (log (* (/ (+ i 128) 256) 1L0)) a))) */
static const double log_table[385] =
{
-0.693147180559945309417232121458176568075,
-0.6853650401178903604697692213970398044,
-0.677642994023980055266378075415729732197,
-0.669980121278410931188432960495886651496,
-0.662375521893191621046203913861404403985,
-0.65482831625780871022347679633437927773,
-0.647337644528651106250552853843513225963,
-0.639902666041133026551361927671647791137,
-0.632522558743510466836625989417756304788,
-0.625196518651437560022666843685547154042,
-0.617923759322357783718626781474514153438,
-0.61070351134887071814907205278986876216,
-0.60353502187025817679728065207969203929,
-0.59641755410139419712166106497071313106,
-0.58935038687830174459117031769420187977,
-0.582332814219655195222425952134964639978,
-0.575364144903561854878438011987654863008,
-0.568443702058988073553825606077313299585,
-0.561570822771226036828515992768693405624,
-0.554744857700826173731906247856527380683,
-0.547965170715447412135297057717612244552,
-0.541231138534103334345428696561292056747,
-0.534542150383306725323860946832334992828,
-0.527897607664638146541620672180936254347,
-0.52129692363328608707713317540302930314,
-0.514739523087127012297831879947234599722,
-0.50822484206593331675332852879892694707,
-0.50175232756031585480793331389686769463,
-0.495321437230025429054660050261215099,
-0.488931639131254417913411735261937295862,
-0.482582411452595671747679308725825054355,
-0.476273242259330949798142595713829069596,
-0.470003629245735553650937031148342064701,
-0.463773079495099479425751396412036696525,
-0.457581109247178400339643902517133157939,
-0.451427243672800141272924605544662667972,
-0.445311016655364052636629355711651820077,
-0.43923197057898186527990882355156990061,
-0.4331896561230192424451526269158655235,
-0.427183632062807368078106194920633178807,
-0.421213465076303550585562626925177406092,
-0.415278729556489003230882088534775334993,
-0.409379007429300711070330899107921801414,
-0.403513887976902632538339065932507598071,
-0.397682967666109433030550215403212372894,
-0.391885849981783528404356583224421075418,
-0.386122145265033447342107580922798666387,
-0.380391470556048421030985561769857535915,
-0.374693449441410693606984907867576972481,
-0.369027711905733333326561361023189215893,
-0.363393894187477327602809309537386757124,
-0.357791638638807479160052541644010369001,
-0.352220593589352099112142921677820359633,
-0.346680413213736728498769933032403617363,
-0.341170757402767124761784665198737642087,
-0.33569129163814153519122263131727209364,
-0.330241686870576856279407775480686721935,
-0.324821619401237656369001967407777741178,
-0.31943077076636122859621528874235306143,
-0.314068827624975851026378775827156709194,
-0.308735481649613269682442058976885699557,
-0.303430429419920096046768517454655701024,
-0.298153372319076331310838085093194799765,
-0.292904016432932602487907019463045397996,
-0.287682072451780927439219005993827431504,
-0.282487255574676923482925918282353780414,
-0.277319285416234343803903228503274262719,
-0.272177885915815673288364959951380595626,
-0.267062785249045246292687241862699949179,
-0.261973715741573968558059642502581569596,
-0.256910413785027239068190798397055267412,
-0.251872619755070079927735679796875342712,
-0.2468600779315257978846419408385075613265,
-0.24187253642048672427253973837916408939,
-0.2369097470783577150364265832942468196375,
-0.2319714654377751430492321958603212094726,
-0.2270574506353460848586128739534071682175,
-0.222167465341154296870334265401817316702,
-0.2173012756899813951520225351537951559,
-0.212458651214193401740613666010165016867,
-0.2076393647782445016154410442673876674964,
-0.202843192514751471266885961812429707545,
-0.1980699137620937948192675366153429027185,
-0.193319311003495979595900706211132426563,
-0.188591169807550022358923589720001638093,
-0.183885278770137362613157202229852743197,
-0.179201429457710992616226033183958974965,
-0.174539416351899677264255125093377869519,
-0.169899036795397472900424896523305726435,
-0.165280090939102924303339903679875604517,
-0.160682381690473465543308397998034325468,
-0.156105714663061654850502877304344269052,
-0.1515498981272009378406898175577424691056,
-0.1470147429618096590348349122269674042104,
-0.142500062607283030157283942253263107981,
-0.1380056730194437167017517619422725179055,
-0.1335313926245226231463436209313499745895,
-0.129077042275142343345847831367985856258,
-0.124642445207276597338493356591214304499,
-0.1202274269981598003244753948319154994493,
-0.115831815525121705099120059938680166568,
-0.1114554409253228268966213677328042273655,
-0.1070981355563671005131126851708522185606,
-0.1027597339577689347753154133345778104976,
-0.098440072813252519902888574928971234883,
-0.094138990913861910035632096996525066015,
-0.0898563291218610470766469347968659624282,
-0.0855919303354035139161469686670511961825,
-0.0813456394539524058873423550293617843895,
-0.077117303344431289769666193261475917783,
-0.072906770808087780565737488890929711303,
-0.0687138925480518083746933774035034481663,
-0.064538521137571171672923915683992928129,
-0.0603805109889074798714456529545968095868,
-0.0562397183228760777967376942769773768851,
-0.0521160011390140183616307870527840213665,
-0.0480092191863606077520036253234446621373,
-0.0439192339348354905263921515528654458042,
-0.0398459085471996706586162402473026835046,
-0.0357891078515852792753420982122404025613,
-0.0317486983145803011569962827485256299276,
-0.0277245480148548604671395114515163869272,
-0.0237165266173160421183468505286730579517,
-0.0197245053477785891192717326571593033246,
-0.015748356968139168607549511460828269521,
-0.0117879557520422404691605618900871263399,
-0.0078431774610258928731840424909435816546,
-0.00391389932113632909231778364357266484272,
0.0,
0.00389864041565732301393734309584290701073,
0.00778214044205494894746290006113676367813,
0.01165061721997527413559144280921434893315,
0.0155041865359652541508540460424468358779,
0.01934296284313093463590553454155047018545,
0.0231670592815343782287991609622899165794,
0.0269765876982020757480692925396595457815,
0.0307716586667536883710282075967721640917,
0.0345523815066597334073715005898328652816,
0.038318864302136599193755325123797290346,
0.042071213920687054375203805926962379448,
0.045809536031294203166679267614663342114,
0.049533935122276630882096208829824573267,
0.0532445145188122828658701937865287769396,
0.0569413764001384247590131015404494943015,
0.0606246218164348425806061320404202632862,
0.0642943507053972572162284502656114944857,
0.0679506619085077493945652777726294140346,
0.071593653187008817925605272752092034269,
0.075223421237587525698605339983662414637,
0.078840061707776024531540577859198294559,
0.082443669211074591268160068668307805914,
0.086034337341803153381797826721996075141,
0.0896121586896871326199514693784845287854,
0.093177224854183289768781353027759396216,
0.096729626458551112295571056487463437015,
0.1002694531636751493081301751297276601964,
0.1037967936816435648260618037639746883066,
0.1073117357890880506671750303711543368066,
0.1108143663402901141948061693232119280986,
0.1143047712800586336342591448151747734094,
0.1177830356563834545387941094705217050686,
0.1212492436328696851612122640808405265723,
0.1247034785009572358634065153808632684918,
0.128145822691930038174109886961074873852,
0.1315763577887192725887161286894831624516,
0.134995164537504830601983291147085645626,
0.138402322859119135685325873601649187393,
0.1417979118602573498789527352804727189846,
0.1451820098444978972819350637405643235226,
0.1485546943231371429098223170672938691604,
0.151916042025841975071803424896884511328,
0.1552661289111239515223833017101021786436,
0.1586050301766385840933711746258415752456,
0.161932820269313253240338285123614220592,
0.165249572895307162875611449277240313729,
0.1685553610298066669415865321701023169345,
0.171850256926659222340098946055147264935,
0.1751343321278491480142914649863898412374,
0.1784076574728182971194002415109419683545,
0.181670303107634678260605595617079739242,
0.184922338494011992663903592659249621006,
0.1881638324181829868259905803105539806714,
0.191394852999629454609298807561308873447,
0.194615467699671658858138593767269731516,
0.1978257433299198803625720711969614690756,
0.201025746060590741340908337591797808969,
0.204215541428690891503820386196239272214,
0.2073951943460705871587455788490062338536,
0.210564769107349637669552812732351513721,
0.2137243293977181388619051976331987647734,
0.216873938300614359619089525744347498479,
0.220013658305282095907358638661628360712,
0.2231435513142097557662950903098345033745,
0.226263678650453389361787082280390161607,
0.229374101064845829991480725046139871551,
0.232474878743094064920705078095567528222,
0.235566071312766909077588218941043410137,
0.2386477378501750099171491363522813392526,
0.241719936887145168144307515913513900104,
0.244782726417690916434704717466314811104,
0.247836163904581256780602765746524747999,
0.25088030628580941658844644154994089393,
0.253915209980963444137323297906606667466,
0.256940930897500425446759867911224262093,
0.259957524436926066972079494542311044577,
0.26296504550088135182072917321108602859,
0.265963548497137941339125926537543389269,
0.268953087345503958932974357924497845489,
0.271933715483641758831669494532999161983,
0.274905485872799249167009582983018668293,
0.277868451003456306186350032923401233082,
0.280822662900887784639519758873134832073,
0.28376817313064459834690122235025476666,
0.286705032803954314653250930842073965668,
0.289633292583042676878893055525668970004,
0.292553002686377439978201258664126644308,
0.295464212893835876386681906054964195182,
0.298366972551797281464900430293496918012,
0.301261330578161781012875538233755492657,
0.304147335467296717015819874720446989991,
0.30702503529491186207512454053537790169,
0.309894477722864687861624550833227164546,
0.31275571000389688838624655968831903216,
0.315608778986303334901366180667483174144,
0.318453731118534615810247213590599595595,
0.321290612453734292057863145522557457887,
0.324119468654211976090670760434987352183,
0.326940344995853320592356894073809191681,
0.329753286372467981814422811920789810952,
0.332558337300076601412275626573419425269,
0.335355541921137830257179579814166199074,
0.338144944008716397710235913939267433111,
0.340926586970593210305089199780356208443,
0.34370051385331844468019789211029452987,
0.346466767346208580918462188425772950712,
0.349225389785288304181275421187371759687,
0.35197642315717818465544745625943892599,
0.354719909102929028355011218999317665826,
0.357455888921803774226009490140904474434,
0.360184403575007796281574967493016620926,
0.362905493689368453137824345977489846141,
0.365619199560964711319396875217046453067,
0.368325561158707653048230154050398826898,
0.371024618127872663911964910806824955394,
0.373716409793584080821016832715823506644,
0.376400975164253065997877633436251593315,
0.379078352934969458390853345631019858882,
0.38174858149084833985966626493567607862,
0.384411698910332039734790062481290868519,
0.387067742968448287898902502261817665695,
0.38971675114002521337046360400352086705,
0.392358760602863872479379611988215363485,
0.39499380824086897810639403636498176831,
0.397621930647138489104829072973405554918,
0.40024316412701270692932510199513117008,
0.402857544701083514655197565487057707577,
0.405465108108164381978013115464349136572,
0.408065889808221748430198682969084124381,
0.410659924985268385934306203175822787661,
0.41324724855021933092547601552548590025,
0.415827895143710965613328892954902305356,
0.418401899138883817510763261966760106515,
0.42096929464412963612886716150679597245,
0.423530115505803295718430478017910109426,
0.426084395310900063124544879595476618897,
0.428632167389698760206812276426639053152,
0.43117346481837134085917247895559499848,
0.433708320421559393435847903042186017095,
0.436236766774918070349041323061121300663,
0.438758836207627937745575058511446738878,
0.441274560804875229489496441661301225362,
0.443783972410300981171768440588146426918,
0.446287102628419511532590180619669006749,
0.448783982827006710512822115683937186274,
0.451274644139458585144692383079012478686,
0.453759117467120506644794794442263270651,
0.456237433481587594380805538163929748437,
0.458709622626976664843883309250877913511,
0.461175715122170166367999925597855358603,
0.463635740963032513092182277331163919118,
0.466089729924599224558619247504769399859,
0.468537711563239270375665237462973542708,
0.470979715218791012546897856056359251373,
0.473415770016672131372578393236978550606,
0.475845904869963914265209586304381412175,
0.478270148481470280383546145497464809096,
0.480688529345751907676618455448011551209,
0.48310107575113582273837458485214554795,
0.485507815781700807801791077190788900579,
0.487908777319238973246173184132656942487,
0.490303988045193838150346159645746860531,
0.492693475442575255695076950020077845328,
0.495077266797851514597964584842833665358,
0.497455389202818942250859256731684928918,
0.499827869556449329821331415247044141512,
0.502194734566715494273584171951812573586,
0.504556010752395287058308531738174929982,
0.506911724444854354113196312660089270034,
0.509261901789807946804074919228323824878,
0.51160656874906207851888487520338193135,
0.51394575110223431680100608827421759311,
0.51627947444845449617281928478756106467,
0.518607764208045632152976996364798698556,
0.520930645624185312409809834659637709188,
0.52324814376454783651680722493487084164,
0.525560283522927371382427602307131424923,
0.527867089620842385113892217778300963557,
0.530168586609121617841419630845212405063,
0.532464798869471843873923723460142242606,
0.534755750616027675477923292032637111077,
0.537041465896883654566729244153832299024,
0.539321968595608874655355158077341155752,
0.54159728243274437157654230390043409897,
0.543867430967283517663338989065998323965,
0.546132437598135650382397209231209163864,
0.548392325565573162748150286179863158565,
0.550647117952662279259948179204913460093,
0.552896837686677737580717902230624314327,
0.55514150754050159271548035951590405017,
0.557381150134006357049816540361233647898,
0.559615787935422686270888500526826593487,
0.561845443262691817915664819160697456814,
0.564070138284802966071384290090190711817,
0.566289895023115872590849979337124343595,
0.568504735352668712078738764866962263577,
0.5707146810034715448536245647415894503,
0.572919753561785509092756726626261068625,
0.575119974471387940421742546569273429365,
0.577315365034823604318112061519496401506,
0.579505946414642223855274409488070989814,
0.58169173963462248252061075372537234071,
0.583872765580982679097413356975291104927,
0.586049045003578208904119436287324349516,
0.588220598517086043034868221609113995052,
0.590387446602176374641916708123598757576,
0.59254960960667159874199020959329739696,
0.594707107746692789514343546529205333192,
0.59685996110779383658731192302565801002,
0.59900818964608339938160002446165150206,
0.601151813189334836191674317068856441547,
0.603290851438084262340585186661310605647,
0.6054253239667168894375677681414899356,
0.607555250224541795501085152791125371894,
0.609680649536855273481833501660588408785,
0.611801541105992903529889766428814783686,
0.613917944012370492196929119645563790777,
0.616029877215514019647565928196700650293,
0.618137359555078733872689126674816271683,
0.620240409751857528851494632567246856773,
0.62233904640877874159710264120869663505,
0.62443328801189350104253874405467311991,
0.626523152931352759778820859734204069282,
0.628608659422374137744308205774183639946,
0.6306898256261987050837261409313532241,
0.63276666957103782954578646850357975849,
0.634839209173010211969493840510489008123,
0.63690746223706923162049442718119919119,
0.63897144645792072137962398326473680873,
0.64103117942093129105560133440539254671,
0.643086678603027315392053859585132960477,
0.645137961373584701665228496134731905937,
0.647185044995309550122320631377863036675,
0.64922794662510981889083996990531112227,
0.651266683314958103396333353349672108398,
0.653301272012745638758615881210873884572,
0.65533172956312763209494967856962559648,
0.657358072708360030141890023245936165513,
0.659380318089127826115336413370955804038,
0.661398482245365008260235838709650938148,
0.66341258161706625109695030429080128179,
0.665422632545090448950092610006660181147,
0.667428651271956189947234166318980478403,
0.669430653942629267298885270929503510123,
0.67142865660530232331713904200189252584,
0.67342267521216672029796038880101726475,
0.67541272562017673108090414397019748722,
0.677398823591806140809682609997348298556,
0.67938098479579735014710062847376425181,
0.681359224807903068948071559568089441735,
0.683333559111620688164363148387750369654,
0.68530400309891941654404807896723298642,
0.687270572070960267497006884394346103924,
0.689233281238808980324914337814603903233,
0.691192145724141958859604629216309755938,
0.693147180559945309417232121458176568075
};
return log_table[128 + (int)m] + 2.0 * atanh_z;
}
}

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* written by Jim Meyering and Bruno Haible */

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
@ -22,6 +21,8 @@
/* Specification. */
#include "malloca.h"
#include <stdint.h>
#include "verify.h"
/* The speed critical point in this file is freea() applied to an alloca()
@ -85,7 +86,7 @@ mmalloca (size_t n)
((int *) p)[-1] = MAGIC_NUMBER;
/* Enter p into the hash table. */
slot = (unsigned long) p % HASH_TABLE_SIZE;
slot = (uintptr_t) p % HASH_TABLE_SIZE;
((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
mmalloca_results[slot] = p;
@ -118,7 +119,7 @@ freea (void *p)
{
/* Looks like a mmalloca() result. To see whether it really is one,
perform a lookup in the hash table. */
size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
size_t slot = (uintptr_t) p % HASH_TABLE_SIZE;
void **chain = &mmalloca_results[slot];
for (; *chain != NULL;)
{

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _MALLOCA_H
#define _MALLOCA_H

File diff suppressed because it is too large Load diff

View file

@ -128,7 +128,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
{
const char *encoding = locale_charset ();
if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
{
/* Cf. unistr/u8-mblen.c. */
unsigned char c = (unsigned char) p[0];
@ -185,7 +185,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
/* As a reference for this code, you can use the GNU libiconv
implementation. Look for uses of the RET_TOOFEW macro. */
if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
if (STREQ_OPT (encoding,
"EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
{
if (m == 1)
{
@ -208,9 +209,12 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
goto invalid;
}
if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
|| STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
|| STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
if (STREQ_OPT (encoding,
"EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
|| STREQ_OPT (encoding,
"GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
|| STREQ_OPT (encoding,
"BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
{
if (m == 1)
{
@ -221,7 +225,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
goto invalid;
}
if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
if (STREQ_OPT (encoding,
"EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
{
if (m == 1)
{
@ -239,7 +244,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
goto invalid;
}
if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
if (STREQ_OPT (encoding,
"GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
{
if (m == 1)
{
@ -272,7 +278,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
goto invalid;
}
if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
{
if (m == 1)
{

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _MSVC_INVAL_H
#define _MSVC_INVAL_H

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _MSVC_NOTHROW_H
#define _MSVC_NOTHROW_H

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file is supposed to be used on platforms that lack <netdb.h>.
It is intended to provide definitions and prototypes needed by an

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_NETINET_IN_H

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Glen Lenker and Bruno Haible. */
@ -257,7 +256,7 @@ num_processors (enum nproc_query query)
}
#if defined _SC_NPROCESSORS_ONLN
{ /* This works on glibc, MacOS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
{ /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
Cygwin, Haiku. */
long int nprocs = sysconf (_SC_NPROCESSORS_ONLN);
if (nprocs > 0)
@ -268,7 +267,7 @@ num_processors (enum nproc_query query)
else /* query == NPROC_ALL */
{
#if defined _SC_NPROCESSORS_CONF
{ /* This works on glibc, MacOS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
{ /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
Cygwin, Haiku. */
long int nprocs = sysconf (_SC_NPROCESSORS_CONF);
@ -333,7 +332,7 @@ num_processors (enum nproc_query query)
NPROC_CURRENT and NPROC_ALL. */
#if HAVE_SYSCTL && defined HW_NCPU
{ /* This works on MacOS X, FreeBSD, NetBSD, OpenBSD. */
{ /* This works on Mac OS X, FreeBSD, NetBSD, OpenBSD. */
int nprocs;
size_t len = sizeof (nprocs);
static int mib[2] = { CTL_HW, HW_NCPU };

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Glen Lenker and Bruno Haible. */

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _PATHMAX_H
# define _PATHMAX_H

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _PRINTF_ARGS_H
#define _PRINTF_ARGS_H

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
CHAR_T The element type of the format string.
@ -402,7 +401,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
cp++;
}
#if defined __APPLE__ && defined __MACH__
/* On MacOS X 10.3, PRIdMAX is defined as "qd".
/* On Mac OS X 10.3, PRIdMAX is defined as "qd".
We cannot change it to "lld" because PRIdMAX must also
be understood by the system's printf routines. */
else if (*cp == 'q')

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _PRINTF_PARSE_H
#define _PRINTF_PARSE_H

View file

@ -13,8 +13,7 @@
# 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, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# with this program; if not, see <http://www.gnu.org/licenses/>.
#
# Written by Bruno Haible <haible@clisp.cons.org>.
#

View file

@ -13,8 +13,7 @@
# 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, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# with this program; if not, see <http://www.gnu.org/licenses/>.
#
# Written by Bruno Haible <haible@clisp.cons.org>.
#

View file

@ -14,8 +14,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
size_t length, reg_syntax_t syntax);
@ -273,7 +272,7 @@ int
re_compile_fastmap (bufp)
struct re_pattern_buffer *bufp;
{
re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
re_dfa_t *dfa = bufp->buffer;
char *fastmap = bufp->fastmap;
memset (fastmap, '\0', sizeof (char) * SBC_MAX);
@ -307,7 +306,7 @@ static void
re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
char *fastmap)
{
re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
re_dfa_t *dfa = bufp->buffer;
Idx node_cnt;
bool icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
@ -586,6 +585,9 @@ weak_alias (__regerror, regerror)
static const bitset_t utf8_sb_map =
{
/* Set the first 128 bits. */
# ifdef __GNUC__
[0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
# else
# if 4 * BITSET_WORD_BITS < ASCII_CHARS
# error "bitset_word_t is narrower than 32 bits"
# elif 3 * BITSET_WORD_BITS < ASCII_CHARS
@ -599,6 +601,7 @@ static const bitset_t utf8_sb_map =
>> (SBC_MAX % BITSET_WORD_BITS == 0
? 0
: BITSET_WORD_BITS - SBC_MAX % BITSET_WORD_BITS))
# endif
};
#endif
@ -657,7 +660,7 @@ void
regfree (preg)
regex_t *preg;
{
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
if (BE (dfa != NULL, 1))
free_dfa_content (dfa);
preg->buffer = NULL;
@ -764,7 +767,7 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length,
preg->regs_allocated = REGS_UNALLOCATED;
/* Initialize the dfa. */
dfa = (re_dfa_t *) preg->buffer;
dfa = preg->buffer;
if (BE (preg->allocated < sizeof (re_dfa_t), 0))
{
/* If zero allocated, but buffer is non-null, try to realloc
@ -775,7 +778,7 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length,
if (dfa == NULL)
return REG_ESPACE;
preg->allocated = sizeof (re_dfa_t);
preg->buffer = (unsigned char *) dfa;
preg->buffer = dfa;
}
preg->used = sizeof (re_dfa_t);
@ -850,7 +853,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
{
__re_size_t table_size;
#ifndef _LIBC
char *codeset_name;
const char *codeset_name;
#endif
#ifdef RE_ENABLE_I18N
size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
@ -873,7 +876,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
calculation below, and for similar doubling calculations
elsewhere. And it's <= rather than <, because some of the
doubling calculations add 1 afterwards. */
if (BE (SIZE_MAX / max_object_size / 2 <= pat_len, 0))
if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) / 2 <= pat_len, 0))
return REG_ESPACE;
dfa->nodes_alloc = pat_len + 1;
@ -896,8 +899,10 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
!= 0);
#else
codeset_name = nl_langinfo (CODESET);
if (strcasecmp (codeset_name, "UTF-8") == 0
|| strcasecmp (codeset_name, "UTF8") == 0)
if ((codeset_name[0] == 'U' || codeset_name[0] == 'u')
&& (codeset_name[1] == 'T' || codeset_name[1] == 't')
&& (codeset_name[2] == 'F' || codeset_name[2] == 'f')
&& strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0)
dfa->is_utf8 = 1;
/* We check exhaustively in the loop below if this charset is a
@ -947,9 +952,43 @@ static void
internal_function
init_word_char (re_dfa_t *dfa)
{
int i, j, ch;
dfa->word_ops_used = 1;
for (i = 0, ch = 0; i < BITSET_WORDS; ++i)
int i = 0;
int j;
int ch = 0;
if (BE (dfa->map_notascii == 0, 1))
{
bitset_word_t bits0 = 0x00000000;
bitset_word_t bits1 = 0x03ff0000;
bitset_word_t bits2 = 0x87fffffe;
bitset_word_t bits3 = 0x07fffffe;
if (BITSET_WORD_BITS == 64)
{
dfa->word_char[0] = bits1 << 31 << 1 | bits0;
dfa->word_char[1] = bits3 << 31 << 1 | bits2;
i = 2;
}
else if (BITSET_WORD_BITS == 32)
{
dfa->word_char[0] = bits0;
dfa->word_char[1] = bits1;
dfa->word_char[2] = bits2;
dfa->word_char[3] = bits3;
i = 4;
}
else
goto general_case;
ch = 128;
if (BE (dfa->is_utf8, 1))
{
memset (&dfa->word_char[i], '\0', (SBC_MAX - ch) / 8);
return;
}
}
general_case:
for (; i < BITSET_WORDS; ++i)
for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
if (isalnum (ch) || ch == '_')
dfa->word_char[i] |= (bitset_word_t) 1 << j;
@ -960,7 +999,7 @@ init_word_char (re_dfa_t *dfa)
static void
free_workarea_compile (regex_t *preg)
{
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
bin_tree_storage_t *storage, *next;
for (storage = dfa->str_tree_storage; storage; storage = next)
{
@ -1144,7 +1183,7 @@ optimize_utf8 (re_dfa_t *dfa)
static reg_errcode_t
analyze (regex_t *preg)
{
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
reg_errcode_t ret;
/* Allocate arrays. */
@ -1325,7 +1364,7 @@ lower_subexps (void *extra, bin_tree_t *node)
static bin_tree_t *
lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node)
{
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
bin_tree_t *body = node->left;
bin_tree_t *op, *cls, *tree1, *tree;
@ -2092,7 +2131,7 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
/* Entry point of the parser.
Parse the regular expression REGEXP and return the structure tree.
If an error is occured, ERR is set by error code, and return NULL.
If an error occurs, ERR is set by error code, and return NULL.
This function build the following tree, from regular expression <reg_exp>:
CAT
/ \
@ -2106,7 +2145,7 @@ static bin_tree_t *
parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax,
reg_errcode_t *err)
{
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
bin_tree_t *tree, *eor, *root;
re_token_t current_token;
dfa->syntax = syntax;
@ -2140,7 +2179,7 @@ static bin_tree_t *
parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
{
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
bin_tree_t *tree, *branch = NULL;
tree = parse_branch (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && tree == NULL, 0))
@ -2182,7 +2221,7 @@ parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
{
bin_tree_t *tree, *expr;
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
tree = parse_expression (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && tree == NULL, 0))
return NULL;
@ -2193,16 +2232,21 @@ parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
expr = parse_expression (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && expr == NULL, 0))
{
if (tree != NULL)
postorder (tree, free_tree, NULL);
return NULL;
}
if (tree != NULL && expr != NULL)
{
tree = create_tree (dfa, tree, expr, CONCAT);
if (tree == NULL)
bin_tree_t *newtree = create_tree (dfa, tree, expr, CONCAT);
if (newtree == NULL)
{
postorder (expr, free_tree, NULL);
postorder (tree, free_tree, NULL);
*err = REG_ESPACE;
return NULL;
}
tree = newtree;
}
else if (tree == NULL)
tree = expr;
@ -2221,7 +2265,7 @@ static bin_tree_t *
parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
{
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
bin_tree_t *tree;
switch (token->type)
{
@ -2437,7 +2481,7 @@ static bin_tree_t *
parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
{
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
bin_tree_t *tree;
size_t cur_nsub;
cur_nsub = preg->re_nsub++;
@ -2451,7 +2495,11 @@ parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
{
tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0))
{
if (tree != NULL)
postorder (tree, free_tree, NULL);
*err = REG_EPAREN;
}
if (BE (*err != REG_NOERROR, 0))
return NULL;
}
@ -2529,6 +2577,12 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
*err = REG_BADBR;
return NULL;
}
if (BE (RE_DUP_MAX < (end == REG_MISSING ? start : end), 0))
{
*err = REG_ESIZE;
return NULL;
}
}
else
{
@ -2569,7 +2623,10 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
old_tree = NULL;
if (elem->token.type == SUBEXP)
postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx);
{
uintptr_t subidx = elem->token.opr.idx;
postorder (elem, mark_opt_subexp, (void *) subidx);
}
tree = create_tree (dfa, elem, NULL,
(end == REG_MISSING ? OP_DUP_ASTERISK : OP_ALT));
@ -2615,7 +2672,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
Build the range expression which starts from START_ELEM, and ends
at END_ELEM. The result are written to MBCSET and SBCSET.
RANGE_ALLOC is the allocated size of mbcset->range_starts, and
mbcset->range_ends, is a pointer argument sinse we may
mbcset->range_ends, is a pointer argument since we may
update it. */
static reg_errcode_t
@ -2749,11 +2806,12 @@ build_range_exp (const reg_syntax_t syntax,
static reg_errcode_t
internal_function
build_collating_symbol (bitset_t sbcset,
# ifdef RE_ENABLE_I18N
re_charset_t *mbcset, Idx *coll_sym_alloc,
# endif
const unsigned char *name)
build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
Idx *coll_sym_alloc, const unsigned char *name)
# else /* not RE_ENABLE_I18N */
build_collating_symbol (bitset_t sbcset, const unsigned char *name)
# endif /* not RE_ENABLE_I18N */
{
size_t name_len = strlen ((const char *) name);
if (BE (name_len != 1, 0))
@ -2781,8 +2839,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
const int32_t *symb_table;
const unsigned char *extra;
/* Local function for parse_bracket_exp used in _LIBC environement.
Seek the collating symbol entry correspondings to NAME.
/* Local function for parse_bracket_exp used in _LIBC environment.
Seek the collating symbol entry corresponding to NAME.
Return the index of the symbol in the SYMB_TABLE. */
auto inline int32_t
@ -2885,11 +2943,11 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
return UINT_MAX;
}
/* Local function for parse_bracket_exp used in _LIBC environement.
/* Local function for parse_bracket_exp used in _LIBC environment.
Build the range expression which starts from START_ELEM, and ends
at END_ELEM. The result are written to MBCSET and SBCSET.
RANGE_ALLOC is the allocated size of mbcset->range_starts, and
mbcset->range_ends, is a pointer argument sinse we may
mbcset->range_ends, is a pointer argument since we may
update it. */
auto inline reg_errcode_t
@ -2969,11 +3027,11 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
return REG_NOERROR;
}
/* Local function for parse_bracket_exp used in _LIBC environement.
/* Local function for parse_bracket_exp used in _LIBC environment.
Build the collating element which is represented by NAME.
The result are written to MBCSET and SBCSET.
COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
pointer argument sinse we may update it. */
pointer argument since we may update it. */
auto inline reg_errcode_t
__attribute ((always_inline))
@ -3075,6 +3133,10 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
if (BE (sbcset == NULL, 0))
#endif /* RE_ENABLE_I18N */
{
re_free (sbcset);
#ifdef RE_ENABLE_I18N
re_free (mbcset);
#endif
*err = REG_ESPACE;
return NULL;
}
@ -3413,7 +3475,7 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
Build the equivalence class which is represented by NAME.
The result are written to MBCSET and SBCSET.
EQUIV_CLASS_ALLOC is the allocated size of mbcset->equiv_classes,
is a pointer argument sinse we may update it. */
is a pointer argument since we may update it. */
static reg_errcode_t
#ifdef RE_ENABLE_I18N
@ -3444,19 +3506,18 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
_NL_COLLATE_EXTRAMB);
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_INDIRECTMB);
idx1 = findidx (&cp);
if (BE (idx1 == 0 || cp < name + strlen ((const char *) name), 0))
idx1 = findidx (&cp, -1);
if (BE (idx1 == 0 || *cp != '\0', 0))
/* This isn't a valid character. */
return REG_ECOLLATE;
/* Build single byte matcing table for this equivalence class. */
char_buf[1] = (unsigned char) '\0';
/* Build single byte matching table for this equivalence class. */
len = weights[idx1 & 0xffffff];
for (ch = 0; ch < SBC_MAX; ++ch)
{
char_buf[0] = ch;
cp = char_buf;
idx2 = findidx (&cp);
idx2 = findidx (&cp, 1);
/*
idx2 = table[ch];
*/
@ -3509,7 +3570,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
Build the character class which is represented by NAME.
The result are written to MBCSET and SBCSET.
CHAR_CLASS_ALLOC is the allocated size of mbcset->char_classes,
is a pointer argument sinse we may update it. */
is a pointer argument since we may update it. */
static reg_errcode_t
#ifdef RE_ENABLE_I18N
@ -3705,6 +3766,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
/* This is intended for the expressions like "a{1,3}".
Fetch a number from 'input', and return the number.
Return REG_MISSING if the number field is empty like "{,1}".
Return RE_DUP_MAX + 1 if the number field is too large.
Return REG_ERROR if an error occurred. */
static Idx
@ -3723,8 +3785,9 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
num = ((token->type != CHARACTER || c < '0' || '9' < c
|| num == REG_ERROR)
? REG_ERROR
: ((num == REG_MISSING) ? c - '0' : num * 10 + c - '0'));
num = (num > RE_DUP_MAX) ? REG_ERROR : num;
: num == REG_MISSING
? c - '0'
: MIN (RE_DUP_MAX + 1, num * 10 + c - '0'));
}
return num;
}
@ -3798,7 +3861,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
static reg_errcode_t
mark_opt_subexp (void *extra, bin_tree_t *node)
{
Idx idx = (Idx) (long) extra;
Idx idx = (uintptr_t) extra;
if (node->token.type == SUBEXP && node->token.opr.idx == idx)
node->token.opt_subexp = 1;

View file

@ -14,12 +14,20 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#ifndef _LIBC
# include <config.h>
/* Make sure noone compiles this code with a C++ compiler. */
# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
# endif
# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
# pragma GCC diagnostic ignored "-Wtype-limits"
# endif
#endif
/* Make sure no one compiles this code with a C++ compiler. */
#if defined __cplusplus && defined _LIBC
# error "This is C code, use a C compiler"
#endif
@ -53,7 +61,6 @@
GNU regex allows. Include it before <regex.h>, which correctly
#undefs RE_DUP_MAX and sets it to the right value. */
#include <limits.h>
#include <strings.h>
#include <regex.h>
#include "regex_internal.h"

View file

@ -1,6 +1,6 @@
/* Definitions for data structures and routines for the regular
expression library.
Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2006, 2009-2012
Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@ -15,8 +15,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _REGEX_H
#define _REGEX_H 1
@ -28,13 +27,10 @@
extern "C" {
#endif
/* Define __USE_GNU_REGEX to declare GNU extensions that violate the
/* Define __USE_GNU to declare GNU extensions that violate the
POSIX name space rules. */
#undef __USE_GNU_REGEX
#if (defined _GNU_SOURCE \
|| (!defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE \
&& !defined _XOPEN_SOURCE))
# define __USE_GNU_REGEX 1
#ifdef _GNU_SOURCE
# define __USE_GNU 1
#endif
#ifdef _REGEX_LARGE_OFFSETS
@ -45,16 +41,6 @@ extern "C" {
supported within glibc itself, and glibc users should not define
_REGEX_LARGE_OFFSETS. */
/* The type of the offset of a byte within a string.
For historical reasons POSIX 1003.1-2004 requires that regoff_t be
at least as wide as off_t. However, many common POSIX platforms set
regoff_t to the more-sensible ssize_t and the Open Group has
signalled its intention to change the requirement to be that
regoff_t be at least as wide as ptrdiff_t and ssize_t; see XBD ERN
60 (2005-08-25). We don't know of any hosts where ssize_t or
ptrdiff_t is wider than ssize_t, so ssize_t is safe. */
typedef ssize_t regoff_t;
/* The type of nonnegative object indexes. Traditionally, GNU regex
uses 'int' for these. Code that uses __re_idx_t should work
regardless of whether the type is signed. */
@ -69,10 +55,8 @@ typedef size_t __re_long_size_t;
#else
/* Use types that are binary-compatible with the traditional GNU regex
implementation, which mishandles strings longer than INT_MAX. */
typedef int regoff_t;
/* The traditional GNU regex implementation mishandles strings longer
than INT_MAX. */
typedef int __re_idx_t;
typedef unsigned int __re_size_t;
typedef unsigned long int __re_long_size_t;
@ -93,8 +77,7 @@ typedef unsigned long int active_reg_t;
add or remove a bit, only one other definition need change. */
typedef unsigned long int reg_syntax_t;
#ifdef __USE_GNU_REGEX
#ifdef __USE_GNU
/* If this bit is not set, then \ inside a bracket expression is literal.
If set, then such a \ quotes the following character. */
# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
@ -225,8 +208,7 @@ typedef unsigned long int reg_syntax_t;
/* If this bit is set, then no_sub will be set to 1 during
re_compile_pattern. */
# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
#endif /* defined __USE_GNU_REGEX */
#endif
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
@ -234,7 +216,7 @@ typedef unsigned long int reg_syntax_t;
already-compiled regexps. */
extern reg_syntax_t re_syntax_options;
#ifdef __USE_GNU_REGEX
#ifdef __USE_GNU
/* Define combinations of the above bits for the standard possibilities.
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
@ -246,16 +228,19 @@ extern reg_syntax_t re_syntax_options;
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
| RE_CHAR_CLASSES \
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
# define RE_SYNTAX_GNU_AWK \
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
| RE_INVALID_INTERVAL_ORD) \
& ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS \
| RE_CONTEXT_INVALID_OPS ))
# define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
| RE_INTERVALS | RE_NO_GNU_OPS)
| RE_INTERVALS | RE_NO_GNU_OPS \
| RE_INVALID_INTERVAL_ORD)
# define RE_SYNTAX_GREP \
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
@ -306,13 +291,12 @@ extern reg_syntax_t re_syntax_options;
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* [[[end syntaxes]]] */
#endif /* defined __USE_GNU_REGEX */
#ifdef __USE_GNU_REGEX
/* Maximum number of duplicates an interval can allow. POSIX-conforming
systems might define this in <limits.h>, but we want our
value, so remove any previous define. */
# ifdef _REGEX_INCLUDE_LIMITS_H
# include <limits.h>
# endif
# ifdef RE_DUP_MAX
# undef RE_DUP_MAX
# endif
@ -320,13 +304,12 @@ extern reg_syntax_t re_syntax_options;
/* RE_DUP_MAX is 2**15 - 1 because an earlier implementation stored
the counter as a 2-byte signed integer. This is no longer true, so
RE_DUP_MAX could be increased to (INT_MAX / 10 - 1), or to
((SIZE_MAX - 2) / 10 - 1) if _REGEX_LARGE_OFFSETS is defined.
((SIZE_MAX - 9) / 10) if _REGEX_LARGE_OFFSETS is defined.
However, there would be a huge performance problem if someone
actually used a pattern like a\{214748363\}, so RE_DUP_MAX retains
its historical value. */
# define RE_DUP_MAX (0x7fff)
#endif /* defined __USE_GNU_REGEX */
#endif
/* POSIX 'cflags' bits (i.e., information for 'regcomp'). */
@ -392,11 +375,11 @@ typedef enum
/* Error codes we've added. */
_REG_EEND, /* Premature end. */
_REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
_REG_ESIZE, /* Too large (e.g., repeat count too large). */
_REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
} reg_errcode_t;
#ifdef _XOPEN_SOURCE
#if defined _XOPEN_SOURCE || defined __USE_XOPEN2K
# define REG_ENOSYS _REG_ENOSYS
#endif
#define REG_NOERROR _REG_NOERROR
@ -417,62 +400,50 @@ typedef enum
#define REG_ESIZE _REG_ESIZE
#define REG_ERPAREN _REG_ERPAREN
/* struct re_pattern_buffer normally uses member names like 'buffer'
that POSIX does not allow. In POSIX mode these members have names
with leading 're_' (e.g., 're_buffer'). */
#ifdef __USE_GNU_REGEX
# define _REG_RE_NAME(id) id
# define _REG_RM_NAME(id) id
#else
# define _REG_RE_NAME(id) re_##id
# define _REG_RM_NAME(id) rm_##id
#endif
/* The user can specify the type of the re_translate member by
defining the macro RE_TRANSLATE_TYPE, which defaults to unsigned
char *. This pollutes the POSIX name space, so in POSIX mode just
use unsigned char *. */
#ifdef __USE_GNU_REGEX
# ifndef RE_TRANSLATE_TYPE
# define RE_TRANSLATE_TYPE unsigned char *
# endif
# define REG_TRANSLATE_TYPE RE_TRANSLATE_TYPE
#else
# define REG_TRANSLATE_TYPE unsigned char *
#endif
/* This data structure represents a compiled pattern. Before calling
the pattern compiler, the fields 'buffer', 'allocated', 'fastmap',
'translate', and 'no_sub' can be set. After the pattern has been
compiled, the 're_nsub' field is available. All other fields are
private to the regex routines. */
and 'translate' can be set. After the pattern has been compiled,
the fields 're_nsub', 'not_bol' and 'not_eol' are available. All
other fields are private to the regex routines. */
#ifndef RE_TRANSLATE_TYPE
# define __RE_TRANSLATE_TYPE unsigned char *
# ifdef __USE_GNU
# define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE
# endif
#endif
#ifdef __USE_GNU
# define __REPB_PREFIX(name) name
#else
# define __REPB_PREFIX(name) __##name
#endif
struct re_pattern_buffer
{
/* Space that holds the compiled pattern. It is declared as
'unsigned char *' because its elements are sometimes used as
array indexes. */
unsigned char *_REG_RE_NAME (buffer);
/* Space that holds the compiled pattern. The type
'struct re_dfa_t' is private and is not declared here. */
struct re_dfa_t *__REPB_PREFIX(buffer);
/* Number of bytes to which 'buffer' points. */
__re_long_size_t _REG_RE_NAME (allocated);
__re_long_size_t __REPB_PREFIX(allocated);
/* Number of bytes actually used in 'buffer'. */
__re_long_size_t _REG_RE_NAME (used);
__re_long_size_t __REPB_PREFIX(used);
/* Syntax setting with which the pattern was compiled. */
reg_syntax_t _REG_RE_NAME (syntax);
reg_syntax_t __REPB_PREFIX(syntax);
/* Pointer to a fastmap, if any, otherwise zero. re_search uses the
fastmap, if there is one, to skip over impossible starting points
for matches. */
char *_REG_RE_NAME (fastmap);
char *__REPB_PREFIX(fastmap);
/* Either a translate table to apply to all characters before
comparing them, or zero for no translation. The translation is
applied to a pattern when it is compiled and to a string when it
is matched. */
REG_TRANSLATE_TYPE _REG_RE_NAME (translate);
__RE_TRANSLATE_TYPE __REPB_PREFIX(translate);
/* Number of subexpressions found by the compiler. */
size_t re_nsub;
@ -481,57 +452,70 @@ struct re_pattern_buffer
Well, in truth it's used only in 're_search_2', to see whether or
not we should use the fastmap, so we don't set this absolutely
perfectly; see 're_compile_fastmap' (the "duplicate" case). */
unsigned int _REG_RE_NAME (can_be_null) : 1;
unsigned __REPB_PREFIX(can_be_null) : 1;
/* If REGS_UNALLOCATED, allocate space in the 'regs' structure
for 'max (RE_NREGS, re_nsub + 1)' groups.
If REGS_REALLOCATE, reallocate space if necessary.
If REGS_FIXED, use what's there. */
#ifdef __USE_GNU_REGEX
#ifdef __USE_GNU
# define REGS_UNALLOCATED 0
# define REGS_REALLOCATE 1
# define REGS_FIXED 2
#endif
unsigned int _REG_RE_NAME (regs_allocated) : 2;
unsigned __REPB_PREFIX(regs_allocated) : 2;
/* Set to zero when 're_compile_pattern' compiles a pattern; set to
one by 're_compile_fastmap' if it updates the fastmap. */
unsigned int _REG_RE_NAME (fastmap_accurate) : 1;
unsigned __REPB_PREFIX(fastmap_accurate) : 1;
/* If set, 're_match_2' does not return information about
subexpressions. */
unsigned int _REG_RE_NAME (no_sub) : 1;
unsigned __REPB_PREFIX(no_sub) : 1;
/* If set, a beginning-of-line anchor doesn't match at the beginning
of the string. */
unsigned int _REG_RE_NAME (not_bol) : 1;
unsigned __REPB_PREFIX(not_bol) : 1;
/* Similarly for an end-of-line anchor. */
unsigned int _REG_RE_NAME (not_eol) : 1;
unsigned __REPB_PREFIX(not_eol) : 1;
/* If true, an anchor at a newline matches. */
unsigned int _REG_RE_NAME (newline_anchor) : 1;
/* [[[end pattern_buffer]]] */
unsigned __REPB_PREFIX(newline_anchor) : 1;
};
typedef struct re_pattern_buffer regex_t;
/* Type for byte offsets within the string. POSIX mandates this. */
#ifdef _REGEX_LARGE_OFFSETS
/* POSIX 1003.1-2008 requires that regoff_t be at least as wide as
ptrdiff_t and ssize_t. We don't know of any hosts where ptrdiff_t
is wider than ssize_t, so ssize_t is safe. */
typedef ssize_t regoff_t;
#else
/* The traditional GNU regex implementation mishandles strings longer
than INT_MAX. */
typedef int regoff_t;
#endif
#ifdef __USE_GNU
/* This is the structure we store register match data in. See
regex.texinfo for a full description of what registers match. */
struct re_registers
{
__re_size_t _REG_RM_NAME (num_regs);
regoff_t *_REG_RM_NAME (start);
regoff_t *_REG_RM_NAME (end);
__re_size_t num_regs;
regoff_t *start;
regoff_t *end;
};
/* If 'regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
're_match_2' returns information about at least this many registers
the first time a 'regs' structure is passed. */
#if !defined RE_NREGS && defined __USE_GNU_REGEX
# ifndef RE_NREGS
# define RE_NREGS 30
# endif
#endif
@ -546,13 +530,19 @@ typedef struct
/* Declarations for routines. */
#ifdef __USE_GNU
/* Sets the current default syntax to SYNTAX, and return the old syntax.
You can also simply assign to the 're_syntax_options' variable. */
extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
/* Compile the regular expression PATTERN, with length LENGTH
and syntax given by the global 're_syntax_options', into the buffer
BUFFER. Return NULL if successful, and an error string if not. */
BUFFER. Return NULL if successful, and an error string if not.
To free the allocated storage, you must call 'regfree' on BUFFER.
Note that the translate table must either have been initialised by
'regcomp', with a malloc'ed value, or set to NULL before calling
'regfree'. */
extern const char *re_compile_pattern (const char *__pattern, size_t __length,
struct re_pattern_buffer *__buffer);
@ -609,14 +599,15 @@ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
register data.
Unless this function is called, the first search or match using
BUFFER will allocate its own register data, without freeing the old
data. */
BUFFER will allocate its own register data, without
freeing the old data. */
extern void re_set_registers (struct re_pattern_buffer *__buffer,
struct re_registers *__regs,
__re_size_t __num_regs,
regoff_t *__starts, regoff_t *__ends);
#endif /* Use GNU */
#if defined _REGEX_RE_COMP || defined _LIBC
#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD)
# ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp (const char *);

View file

@ -14,8 +14,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
static void re_string_construct_common (const char *str, Idx len,
re_string_t *pstr,
@ -134,9 +133,9 @@ re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len)
{
wint_t *new_wcs;
/* Avoid overflow. */
size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx));
if (BE (SIZE_MAX / max_object_size < new_buf_len, 0))
/* Avoid overflow in realloc. */
const size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx));
if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_buf_len, 0))
return REG_ESPACE;
new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len);
@ -236,13 +235,8 @@ build_wcs_buffer (re_string_t *pstr)
else
p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx;
mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
if (BE (mbclen == (size_t) -2, 0))
{
/* The buffer doesn't have enough space, finish to build. */
pstr->cur_state = prev_st;
break;
}
else if (BE (mbclen == (size_t) -1 || mbclen == 0, 0))
if (BE (mbclen == (size_t) -1 || mbclen == 0
|| (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len), 0))
{
/* We treat these cases as a singlebyte character. */
mbclen = 1;
@ -251,6 +245,12 @@ build_wcs_buffer (re_string_t *pstr)
wc = pstr->trans[wc];
pstr->cur_state = prev_st;
}
else if (BE (mbclen == (size_t) -2, 0))
{
/* The buffer doesn't have enough space, finish to build. */
pstr->cur_state = prev_st;
break;
}
/* Write wide character and padding. */
pstr->wcs[byte_idx++] = wc;
@ -333,9 +333,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
pstr->wcs[byte_idx++] = WEOF;
}
else if (mbclen == (size_t) -1 || mbclen == 0)
else if (mbclen == (size_t) -1 || mbclen == 0
|| (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
{
/* It is an invalid character or '\0'. Just use the byte. */
/* It is an invalid character, an incomplete character
at the end of the string, or '\0'. Just use the byte. */
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
pstr->mbs[byte_idx] = ch;
/* And also cast it to wide char. */
@ -448,7 +450,8 @@ build_wcs_upper_buffer (re_string_t *pstr)
for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
pstr->wcs[byte_idx++] = WEOF;
}
else if (mbclen == (size_t) -1 || mbclen == 0)
else if (mbclen == (size_t) -1 || mbclen == 0
|| (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
{
/* It is an invalid character or '\0'. Just use the byte. */
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx];
@ -495,8 +498,7 @@ re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc)
rawbuf_idx < new_raw_idx;)
{
wchar_t wc2;
Idx remain_len;
remain_len = pstr->len - rawbuf_idx;
Idx remain_len = pstr->raw_len - rawbuf_idx;
prev_st = pstr->cur_state;
mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx,
remain_len, &pstr->cur_state);
@ -732,21 +734,21 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
mbstate_t cur_state;
wchar_t wc2;
Idx mlen = raw + pstr->len - p;
unsigned char buf[6];
size_t mbclen;
#if 0 /* dead code: buf is set but never used */
unsigned char buf[6];
const unsigned char *pp = p;
if (BE (pstr->trans != NULL, 0))
{
int i = mlen < 6 ? mlen : 6;
while (--i >= 0)
buf[i] = pstr->trans[p[i]];
pp = buf;
}
#endif
/* XXX Don't use mbrtowc, we know which conversion
to use (UTF-8 -> UCS4). */
memset (&cur_state, 0, sizeof (cur_state));
mbclen = __mbrtowc (&wc2, (const char *) p, mlen,
mbclen = __mbrtowc (&wc2, (const char *) pp, mlen,
&cur_state);
if (raw + offset - p <= mbclen
&& mbclen < (size_t) -2)
@ -868,7 +870,7 @@ re_string_peek_byte_case (const re_string_t *pstr, Idx idx)
}
static unsigned char
internal_function __attribute ((pure))
internal_function
re_string_fetch_byte_case (re_string_t *pstr)
{
if (BE (!pstr->mbs_allocated, 1))
@ -1412,13 +1414,12 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
Idx *new_nexts, *new_indices;
re_node_set *new_edests, *new_eclosures;
re_token_t *new_nodes;
size_t max_object_size =
MAX (sizeof (re_token_t),
/* Avoid overflows in realloc. */
const size_t max_object_size = MAX (sizeof (re_token_t),
MAX (sizeof (re_node_set),
sizeof (Idx)));
/* Avoid overflows. */
if (BE (SIZE_MAX / 2 / max_object_size < dfa->nodes_alloc, 0))
if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_nodes_alloc, 0))
return REG_MISSING;
new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc);
@ -1579,7 +1580,7 @@ register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
{
Idx elem = newstate->nodes.elems[i];
if (!IS_EPSILON_NODE (dfa->nodes[elem].type))
if (BE (! re_node_set_insert_last (&newstate->non_eps_nodes, elem), 0))
if (! re_node_set_insert_last (&newstate->non_eps_nodes, elem))
return REG_ESPACE;
}
@ -1614,7 +1615,7 @@ free_state (re_dfastate_t *state)
re_free (state);
}
/* Create the new state which is independ of contexts.
/* Create the new state which is independent of contexts.
Return the new state if succeeded, otherwise return NULL. */
static re_dfastate_t *

View file

@ -14,15 +14,13 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _REGEX_INTERNAL_H
#define _REGEX_INTERNAL_H 1
#include <assert.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -32,13 +30,14 @@
# include "localcharset.h"
#endif
#include <locale.h>
#include <wchar.h>
#include <wctype.h>
#include <stdbool.h>
#include <stdint.h>
#if defined _LIBC
# include <bits/libc-lock.h>
#else
# define __libc_lock_define(CLASS,NAME)
# define __libc_lock_init(NAME) do { } while (0)
# define __libc_lock_lock(NAME) do { } while (0)
# define __libc_lock_unlock(NAME) do { } while (0)
@ -76,11 +75,6 @@
# define gettext_noop(String) String
#endif
/* For loser systems without the definition. */
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC
# define RE_ENABLE_I18N
#endif
@ -111,8 +105,8 @@
# define __wctype wctype
# define __iswctype iswctype
# define __btowc btowc
# define __wcrtomb wcrtomb
# define __mbrtowc mbrtowc
# define __wcrtomb wcrtomb
# define __regfree regfree
# define attribute_hidden
#endif /* not _LIBC */
@ -124,6 +118,11 @@
#endif
typedef __re_idx_t Idx;
#ifdef _REGEX_LARGE_OFFSETS
# define IDX_MAX (SIZE_MAX - 2)
#else
# define IDX_MAX INT_MAX
#endif
/* Special return value for failure to match. */
#define REG_MISSING ((Idx) -1)
@ -418,19 +417,21 @@ typedef struct re_dfa_t re_dfa_t;
# define internal_function
#endif
#ifndef NOT_IN_libc
static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
Idx new_buf_len)
internal_function;
#ifdef RE_ENABLE_I18N
# ifdef RE_ENABLE_I18N
static void build_wcs_buffer (re_string_t *pstr) internal_function;
static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr)
internal_function;
#endif /* RE_ENABLE_I18N */
# endif /* RE_ENABLE_I18N */
static void build_upper_buffer (re_string_t *pstr) internal_function;
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
int eflags)
internal_function __attribute ((pure));
#endif
#define re_string_peek_byte(pstr, offset) \
((pstr)->mbs[(pstr)->cur_idx + offset])
#define re_string_fetch_byte(pstr) \
@ -468,6 +469,9 @@ static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
#ifndef MAX
# define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
#ifndef MIN
# define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
@ -692,9 +696,7 @@ struct re_dfa_t
#ifdef DEBUG
char* re_str;
#endif
#ifdef _LIBC
__libc_lock_define (, lock)
#endif
};
#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
@ -818,6 +820,7 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
return (wint_t) pstr->wcs[idx];
}
# ifndef NOT_IN_libc
static int
internal_function __attribute ((pure))
re_string_elem_size_at (const re_string_t *pstr, Idx idx)
@ -825,7 +828,6 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
# ifdef _LIBC
const unsigned char *p, *extra;
const int32_t *table, *indirect;
int32_t tmp;
# include <locale/weight.h>
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
@ -837,13 +839,14 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_INDIRECTMB);
p = pstr->mbs + idx;
tmp = findidx (&p);
findidx (&p, pstr->len - idx);
return p - pstr->mbs - idx;
}
else
# endif /* _LIBC */
return 1;
}
# endif
#endif /* RE_ENABLE_I18N */
#ifndef __GNUC_PREREQ

View file

@ -14,8 +14,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
Idx n) internal_function;
@ -51,9 +50,8 @@ static regoff_t re_search_stub (struct re_pattern_buffer *bufp,
regoff_t range, Idx stop,
struct re_registers *regs,
bool ret_len) internal_function;
static unsigned int re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
Idx nregs, int regs_allocated)
internal_function;
static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
Idx nregs, int regs_allocated) internal_function;
static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx)
internal_function;
static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match,
@ -230,7 +228,7 @@ regexec (preg, string, nmatch, pmatch, eflags)
reg_errcode_t err;
Idx start, length;
#ifdef _LIBC
re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
re_dfa_t *dfa = preg->buffer;
#endif
if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
@ -365,7 +363,6 @@ weak_alias (__re_search_2, re_search_2)
#endif
static regoff_t
internal_function
re_search_2_stub (struct re_pattern_buffer *bufp,
const char *string1, Idx length1,
const char *string2, Idx length2,
@ -413,7 +410,6 @@ re_search_2_stub (struct re_pattern_buffer *bufp,
otherwise the position of the match is returned. */
static regoff_t
internal_function
re_search_stub (struct re_pattern_buffer *bufp,
const char *string, Idx length,
Idx start, regoff_t range, Idx stop, struct re_registers *regs,
@ -425,7 +421,7 @@ re_search_stub (struct re_pattern_buffer *bufp,
regoff_t rval;
int eflags = 0;
#ifdef _LIBC
re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
re_dfa_t *dfa = bufp->buffer;
#endif
Idx last_start = start + range;
@ -477,9 +473,9 @@ re_search_stub (struct re_pattern_buffer *bufp,
rval = 0;
/* I hope we needn't fill ther regs with -1's when no match was found. */
/* I hope we needn't fill their regs with -1's when no match was found. */
if (result != REG_NOERROR)
rval = -1;
rval = result == REG_NOMATCH ? -1 : -2;
else if (regs != NULL)
{
/* If caller wants register contents data back, copy them. */
@ -505,8 +501,7 @@ re_search_stub (struct re_pattern_buffer *bufp,
return rval;
}
static unsigned int
internal_function
static unsigned
re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs,
int regs_allocated)
{
@ -636,7 +631,7 @@ re_exec (s)
(0 <= LAST_START && LAST_START <= LENGTH) */
static reg_errcode_t
internal_function __attribute_warn_unused_result__
__attribute_warn_unused_result__
re_search_internal (const regex_t *preg,
const char *string, Idx length,
Idx start, Idx last_start, Idx stop,
@ -644,7 +639,7 @@ re_search_internal (const regex_t *preg,
int eflags)
{
reg_errcode_t err;
const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
const re_dfa_t *dfa = preg->buffer;
Idx left_lim, right_lim;
int incr;
bool fl_longest_match;
@ -719,7 +714,8 @@ re_search_internal (const regex_t *preg,
if (nmatch > 1 || dfa->has_mb_node)
{
/* Avoid overflow. */
if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= mctx.input.bufs_len, 0))
if (BE ((MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *))
<= mctx.input.bufs_len), 0))
{
err = REG_ESPACE;
goto free_return;
@ -921,7 +917,7 @@ re_search_internal (const regex_t *preg,
goto free_return;
}
/* At last, add the offset to the each registers, since we slided
/* At last, add the offset to each register, since we slid
the buffers so that we could assume that the matching starts
from 0. */
for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
@ -971,7 +967,7 @@ re_search_internal (const regex_t *preg,
}
static reg_errcode_t
internal_function __attribute_warn_unused_result__
__attribute_warn_unused_result__
prune_impossible_nodes (re_match_context_t *mctx)
{
const re_dfa_t *const dfa = mctx->dfa;
@ -987,7 +983,7 @@ prune_impossible_nodes (re_match_context_t *mctx)
halt_node = mctx->last_node;
/* Avoid overflow. */
if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= match_last, 0))
if (BE (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) <= match_last, 0))
return REG_ESPACE;
sifted_states = re_malloc (re_dfastate_t *, match_last + 1);
@ -1105,7 +1101,7 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
FL_LONGEST_MATCH means we want the POSIX longest matching.
If P_MATCH_FIRST is not NULL, and the match fails, it is set to the
next place where we may want to try matching.
Note that the matcher assume that the maching starts from the current
Note that the matcher assumes that the matching starts from the current
index of the buffer. */
static Idx
@ -1174,7 +1170,8 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match,
re_dfastate_t *old_state = cur_state;
Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1;
if (BE (next_char_idx >= mctx->input.bufs_len, 0)
if ((BE (next_char_idx >= mctx->input.bufs_len, 0)
&& mctx->input.bufs_len < mctx->input.len)
|| (BE (next_char_idx >= mctx->input.valid_len, 0)
&& mctx->input.valid_len < mctx->input.len))
{
@ -1435,7 +1432,7 @@ internal_function __attribute_warn_unused_result__
set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
regmatch_t *pmatch, bool fl_backtrack)
{
const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
const re_dfa_t *dfa = preg->buffer;
Idx idx, cur_node;
re_node_set eps_via_nodes;
struct re_fail_stack_t *fs;
@ -1752,7 +1749,8 @@ clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx)
{
Idx top = mctx->state_log_top;
if (next_state_log_idx >= mctx->input.bufs_len
if ((next_state_log_idx >= mctx->input.bufs_len
&& mctx->input.bufs_len < mctx->input.len)
|| (next_state_log_idx >= mctx->input.valid_len
&& mctx->input.valid_len < mctx->input.len))
{
@ -2456,7 +2454,7 @@ find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
/* From the node set CUR_NODES, pick up the nodes whose types are
OP_OPEN_SUBEXP and which have corresponding back references in the regular
expression. And register them to use them later for evaluating the
correspoding back references. */
corresponding back references. */
static reg_errcode_t
internal_function
@ -2936,9 +2934,12 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node,
{
re_dfastate_t **new_array;
Idx old_alloc = path->alloc;
Idx new_alloc = old_alloc + last_str + mctx->max_mb_elem_len + 1;
if (BE (new_alloc < old_alloc, 0)
|| BE (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc, 0))
Idx incr_alloc = last_str + mctx->max_mb_elem_len + 1;
Idx new_alloc;
if (BE (IDX_MAX - old_alloc < incr_alloc, 0))
return REG_ESPACE;
new_alloc = old_alloc + incr_alloc;
if (BE (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc, 0))
return REG_ESPACE;
new_array = re_realloc (path->array, re_dfastate_t *, new_alloc);
if (BE (new_array == NULL, 0))
@ -3387,7 +3388,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
dests_node = dests_alloc->dests_node;
dests_ch = dests_alloc->dests_ch;
/* Initialize transiton table. */
/* Initialize transition table. */
state->word_trtable = state->trtable = NULL;
/* At first, group all nodes belonging to 'state' into several
@ -3397,6 +3398,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
{
if (dests_node_malloced)
free (dests_alloc);
/* Return false in case of an error, true otherwise. */
if (ndests == 0)
{
state->trtable = (re_dfastate_t **)
@ -3896,7 +3898,6 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
const int32_t *table, *indirect;
const unsigned char *weights, *extra;
const char *collseqwc;
int32_t idx;
/* This #include defines a local function! */
# include <locale/weight.h>
@ -3954,7 +3955,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
indirect = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
int32_t idx = findidx (&cp);
int32_t idx = findidx (&cp, elem_len);
if (idx > 0)
for (i = 0; i < cset->nequiv_classes; ++i)
{
@ -4066,7 +4067,7 @@ find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
/* Skip the collation sequence value. */
idx += sizeof (uint32_t);
/* Skip the wide char sequence of the collating element. */
idx = idx + sizeof (uint32_t) * (extra[idx] + 1);
idx = idx + sizeof (uint32_t) * (*(int32_t *) (extra + idx) + 1);
/* If we found the entry, return the sequence value. */
if (found)
return *(uint32_t *) (extra + idx);
@ -4140,11 +4141,12 @@ extend_buffers (re_match_context_t *mctx)
re_string_t *pstr = &mctx->input;
/* Avoid overflow. */
if (BE (SIZE_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0))
if (BE (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) / 2
<= pstr->bufs_len, 0))
return REG_ESPACE;
/* Double the lengthes of the buffers. */
ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
/* Double the lengths of the buffers. */
ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2));
if (BE (ret != REG_NOERROR, 0))
return ret;
@ -4207,7 +4209,7 @@ match_ctx_init (re_match_context_t *mctx, int eflags, Idx n)
size_t max_object_size =
MAX (sizeof (struct re_backref_cache_entry),
sizeof (re_sub_match_top_t *));
if (BE (SIZE_MAX / max_object_size < n, 0))
if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < n, 0))
return REG_ESPACE;
mctx->bkref_ents = re_malloc (struct re_backref_cache_entry, n);

174
lib/round.c Normal file
View file

@ -0,0 +1,174 @@
/* Round toward nearest, breaking ties away from zero.
Copyright (C) 2007, 2010-2012 Free Software Foundation, Inc.
This program 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, 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 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 <http://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff <blp@gnu.org>, 2007.
Based heavily on code by Bruno Haible. */
#if ! defined USE_LONG_DOUBLE
# include <config.h>
#endif
/* Specification. */
#include <math.h>
#include <float.h>
#undef MIN
#ifdef USE_LONG_DOUBLE
# define ROUND roundl
# define FLOOR floorl
# define CEIL ceill
# define DOUBLE long double
# define MANT_DIG LDBL_MANT_DIG
# define MIN LDBL_MIN
# define L_(literal) literal##L
# define HAVE_FLOOR_AND_CEIL HAVE_FLOORL_AND_CEILL
#elif ! defined USE_FLOAT
# define ROUND round
# define FLOOR floor
# define CEIL ceil
# define DOUBLE double
# define MANT_DIG DBL_MANT_DIG
# define MIN DBL_MIN
# define L_(literal) literal
# define HAVE_FLOOR_AND_CEIL 1
#else /* defined USE_FLOAT */
# define ROUND roundf
# define FLOOR floorf
# define CEIL ceilf
# define DOUBLE float
# define MANT_DIG FLT_MANT_DIG
# define MIN FLT_MIN
# define L_(literal) literal##f
# define HAVE_FLOOR_AND_CEIL HAVE_FLOORF_AND_CEILF
#endif
/* -0.0. See minus-zero.h. */
#if defined __hpux || defined __sgi || defined __ICC
# define MINUS_ZERO (-MIN * MIN)
#else
# define MINUS_ZERO L_(-0.0)
#endif
/* MSVC with option -fp:strict refuses to compile constant initializers that
contain floating-point operations. Pacify this compiler. */
#ifdef _MSC_VER
# pragma fenv_access (off)
#endif
/* If we're being included from test-round2[f].c, it already defined names for
our round implementations. Otherwise, pick the preferred implementation for
this machine. */
#if !defined FLOOR_BASED_ROUND && !defined FLOOR_FREE_ROUND
# if HAVE_FLOOR_AND_CEIL
# define FLOOR_BASED_ROUND ROUND
# else
# define FLOOR_FREE_ROUND ROUND
# endif
#endif
#ifdef FLOOR_BASED_ROUND
/* An implementation of the C99 round function based on floor and ceil. We use
this when floor and ceil are available, on the assumption that they are
faster than the open-coded versions below. */
DOUBLE
FLOOR_BASED_ROUND (DOUBLE x)
{
if (x >= L_(0.0))
{
DOUBLE y = FLOOR (x);
if (x - y >= L_(0.5))
y += L_(1.0);
return y;
}
else
{
DOUBLE y = CEIL (x);
if (y - x >= L_(0.5))
y -= L_(1.0);
return y;
}
}
#endif /* FLOOR_BASED_ROUND */
#ifdef FLOOR_FREE_ROUND
/* An implementation of the C99 round function without floor or ceil.
We use this when floor or ceil is missing. */
DOUBLE
FLOOR_FREE_ROUND (DOUBLE x)
{
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.
Use the identity
n = floor(n/5) + floor((n+1)/5) + ... + floor((n+4)/5). */
(DOUBLE) (1U << ((MANT_DIG - 1) / 5))
* (DOUBLE) (1U << ((MANT_DIG - 1 + 1) / 5))
* (DOUBLE) (1U << ((MANT_DIG - 1 + 2) / 5))
* (DOUBLE) (1U << ((MANT_DIG - 1 + 3) / 5))
* (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
/* The use of 'volatile' guarantees that excess precision bits are dropped at
each addition step and before the following comparison at the caller's
site. It is necessary on x86 systems where double-floats are not IEEE
compliant by default, to avoid that the results become platform and
compiler option dependent. 'volatile' is a portable alternative to gcc's
-ffloat-store option. */
volatile DOUBLE y = x;
volatile DOUBLE z = y;
if (z > L_(0.0))
{
/* Avoid rounding error for x = 0.5 - 2^(-MANT_DIG-1). */
if (z < L_(0.5))
z = L_(0.0);
/* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */
else if (z < TWO_MANT_DIG)
{
/* Add 0.5 to the absolute value. */
y = z += L_(0.5);
/* Round to the next integer (nearest or up or down, doesn't
matter). */
z += TWO_MANT_DIG;
z -= TWO_MANT_DIG;
/* Enforce rounding down. */
if (z > y)
z -= L_(1.0);
}
}
else if (z < L_(0.0))
{
/* Avoid rounding error for x = -(0.5 - 2^(-MANT_DIG-1)). */
if (z > - L_(0.5))
z = MINUS_ZERO;
/* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1. */
else if (z > -TWO_MANT_DIG)
{
/* Add 0.5 to the absolute value. */
y = z -= L_(0.5);
/* Round to the next integer (nearest or up or down, doesn't
matter). */
z -= TWO_MANT_DIG;
z += TWO_MANT_DIG;
/* Enforce rounding up. */
if (z < y)
z += L_(1.0);
}
}
return z;
}
#endif /* FLOOR_FREE_ROUND */

View file

@ -17,7 +17,7 @@
/* Some system calls may be interrupted and fail with errno = EINTR in the
following situations:
- The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
types Ctrl-Z) on some platforms: MacOS X.
types Ctrl-Z) on some platforms: Mac OS X.
- The process receives a signal for which a signal handler was installed
with sigaction() with an sa_flags field that does not contain
SA_RESTART.

View file

@ -17,7 +17,7 @@
/* Some system calls may be interrupted and fail with errno = EINTR in the
following situations:
- The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
types Ctrl-Z) on some platforms: MacOS X.
types Ctrl-Z) on some platforms: Mac OS X.
- The process receives a signal for which a signal handler was installed
with sigaction() with an sa_flags field that does not contain
SA_RESTART.

View file

@ -55,7 +55,7 @@
#ifndef _@GUARD_PREFIX@_SIGNAL_H
#define _@GUARD_PREFIX@_SIGNAL_H
/* MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
pthread_sigmask in <pthread.h>, not in <signal.h>.
But avoid namespace pollution on glibc systems.*/
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
@ -197,7 +197,7 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
/* Test whether a given signal is contained in a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigismember
# endif
@ -210,7 +210,7 @@ _GL_CXXALIASWARN (sigismember);
/* Initialize a signal set to the empty set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigemptyset
# endif
@ -222,7 +222,7 @@ _GL_CXXALIASWARN (sigemptyset);
/* Add a signal to a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigaddset
# endif
@ -235,7 +235,7 @@ _GL_CXXALIASWARN (sigaddset);
/* Remove a signal from a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigdelset
# endif
@ -248,7 +248,7 @@ _GL_CXXALIASWARN (sigdelset);
/* Fill a signal set with all possible signals. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on MacOS X. */
/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigfillset
# endif

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef GNULIB_SIZE_MAX_H
#define GNULIB_SIZE_MAX_H

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>

View file

@ -27,6 +27,21 @@
#include <sys/stat.h>
#undef __need_system_sys_stat_h
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# if _GL_WINDOWS_64_BIT_ST_SIZE
# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
# define stat _stati64
# define REPLACE_FUNC_STAT_DIR 1
# undef REPLACE_FUNC_STAT_FILE
# elif REPLACE_FUNC_STAT_FILE
/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
Bypass it. */
# define stat _stat
# define REPLACE_FUNC_STAT_DIR 1
# undef REPLACE_FUNC_STAT_FILE
# endif
#endif
static inline int
orig_stat (const char *filename, struct stat *buf)
{

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert and Bruno Haible. */

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_STDBOOL_H
#define _GL_STDBOOL_H

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* ISO C 99 <stdint.h> for platforms that lack it.
@ -34,6 +33,16 @@
<inttypes.h>. */
#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
/* On Android (Bionic libc), <sys/types.h> includes this file before
having defined 'time_t'. Therefore in this case avoid including
other system header files; just include the system's <stdint.h>.
Ideally we should test __BIONIC__ here, but it is only defined after
<sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
#if defined __ANDROID__ \
&& defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
#else
/* Get those types that are already defined in other system include
files, so that we can "#define int8_t signed char" below without
worrying about a later system include file containing a "typedef
@ -74,14 +83,15 @@
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
AIX 5.2 <sys/types.h> isn't needed and causes troubles.
MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
relies on the system <stdint.h> definitions, so include
<sys/types.h> after @NEXT_STDINT_H@. */
#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
# include <sys/types.h>
#endif
/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
LONG_MIN, LONG_MAX, ULONG_MAX. */
#include <limits.h>
#if @HAVE_INTTYPES_H@
@ -237,8 +247,9 @@ typedef unsigned long long int gl_uint64_t;
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
are taken from the same list of types. Assume that 'long int'
is fast enough for all narrower integers. */
are taken from the same list of types. The following code normally
uses types consistent with glibc, as that lessens the chance of
incompatibility with older GNU hosts. */
#undef int_fast8_t
#undef uint_fast8_t
@ -248,12 +259,21 @@ typedef unsigned long long int gl_uint64_t;
#undef uint_fast32_t
#undef int_fast64_t
#undef uint_fast64_t
typedef long int gl_int_fast8_t;
typedef unsigned long int gl_uint_fast8_t;
typedef long int gl_int_fast16_t;
typedef unsigned long int gl_uint_fast16_t;
typedef signed char gl_int_fast8_t;
typedef unsigned char gl_uint_fast8_t;
#ifdef __sun
/* Define types compatible with SunOS 5.10, so that code compiled under
earlier SunOS versions works with code compiled under SunOS 5.10. */
typedef int gl_int_fast32_t;
typedef unsigned int gl_uint_fast32_t;
#else
typedef long int gl_int_fast32_t;
typedef unsigned long int gl_uint_fast32_t;
#endif
typedef gl_int_fast32_t gl_int_fast16_t;
typedef gl_uint_fast32_t gl_uint_fast16_t;
#define int_fast8_t gl_int_fast8_t
#define uint_fast8_t gl_uint_fast8_t
#define int_fast16_t gl_int_fast16_t
@ -409,23 +429,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
#undef INT_FAST8_MIN
#undef INT_FAST8_MAX
#undef UINT_FAST8_MAX
#define INT_FAST8_MIN LONG_MIN
#define INT_FAST8_MAX LONG_MAX
#define UINT_FAST8_MAX ULONG_MAX
#define INT_FAST8_MIN SCHAR_MIN
#define INT_FAST8_MAX SCHAR_MAX
#define UINT_FAST8_MAX UCHAR_MAX
#undef INT_FAST16_MIN
#undef INT_FAST16_MAX
#undef UINT_FAST16_MAX
#define INT_FAST16_MIN LONG_MIN
#define INT_FAST16_MAX LONG_MAX
#define UINT_FAST16_MAX ULONG_MAX
#define INT_FAST16_MIN INT_FAST32_MIN
#define INT_FAST16_MAX INT_FAST32_MAX
#define UINT_FAST16_MAX UINT_FAST32_MAX
#undef INT_FAST32_MIN
#undef INT_FAST32_MAX
#undef UINT_FAST32_MAX
#define INT_FAST32_MIN LONG_MIN
#define INT_FAST32_MAX LONG_MAX
#define UINT_FAST32_MAX ULONG_MAX
#ifdef __sun
# define INT_FAST32_MIN INT_MIN
# define INT_FAST32_MAX INT_MAX
# define UINT_FAST32_MAX UINT_MAX
#else
# define INT_FAST32_MIN LONG_MIN
# define INT_FAST32_MAX LONG_MAX
# define UINT_FAST32_MAX ULONG_MAX
#endif
#undef INT_FAST64_MIN
#undef INT_FAST64_MAX
@ -606,4 +632,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
#endif
#endif /* _@GUARD_PREFIX@_STDINT_H */
#endif /* !(defined __ANDROID__ && ...) */
#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@ -53,7 +52,8 @@
#include <stddef.h>
/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
and eglibc 2.11.2. */
and eglibc 2.11.2.
May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
/* The __attribute__ feature is available in gcc versions 2.5 and later.
@ -699,22 +699,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
# endif
#endif
#if @GNULIB_GETS@
# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gets
# define gets rpl_gets
# endif
_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (gets, char *, (char *s));
# else
_GL_CXXALIAS_SYS (gets, char *, (char *s));
# undef gets
# endif
_GL_CXXALIASWARN (gets);
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
so any use of gets warrants an unconditional warning; besides, C11
removed it. */
#undef gets
#if HAVE_RAW_DECL_GETS
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
@ -779,7 +768,7 @@ _GL_CXXALIASWARN (pclose);
#elif defined GNULIB_POSIXCHECK
# undef pclose
# if HAVE_RAW_DECL_PCLOSE
_GL_WARN_ON_USE (pclose, "popen is unportable - "
_GL_WARN_ON_USE (pclose, "pclose is unportable - "
"use gnulib module pclose for more portability");
# endif
#endif
@ -1054,9 +1043,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
# endif
#endif
/* Some people would argue that sprintf should be handled like gets
(for example, OpenBSD issues a link warning for both functions),
since both can cause security holes due to buffer overruns.
/* Some people would argue that all sprintf uses should be warned about
(for example, OpenBSD issues a link warning for it),
since it can cause security holes due to buffer overruns.
However, we believe that sprintf can be used safely, and is more
efficient than snprintf in those safe cases; and as proof of our
belief, we use sprintf in several gnulib modules. So this header

View file

@ -87,13 +87,21 @@ struct random_data
#endif
#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
/* On MacOS X 10.5, only <unistd.h> declares mkstemps. */
/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
/* But avoid namespace pollution on glibc systems and native Windows. */
# include <unistd.h>
#endif
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
# define _GL_ATTRIBUTE_PURE /* empty */
#endif
/* The definition of _Noreturn is copied here. */
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -138,7 +146,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
/* Parse a signed decimal integer.
Returns the value of the integer. Errors are not detected. */
# if !@HAVE_ATOLL@
_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
_GL_CXXALIASWARN (atoll);

View file

@ -1,63 +0,0 @@
/* Case-insensitive string comparison function.
Copyright (C) 1998-1999, 2005-2007, 2009-2012 Free Software Foundation, Inc.
This program 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, 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 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <config.h>
/* Specification. */
#include <string.h>
#include <ctype.h>
#include <limits.h>
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2.
Note: This function does not work with multibyte strings! */
int
strcasecmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2)
return 0;
do
{
c1 = TOLOWER (*p1);
c2 = TOLOWER (*p2);
if (c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
if (UCHAR_MAX <= INT_MAX)
return c1 - c2;
else
/* On machines where 'char' and 'int' are types of the same size, the
difference of two 'unsigned char' values - including the sign bit -
doesn't fit in an 'int'. */
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
}

View file

@ -21,8 +21,8 @@
#include <string.h>
/* STREQ allows to optimize string comparison with a small literal string.
STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
/* STREQ_OPT allows to optimize string comparison with a small literal string.
STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
is semantically equivalent to
strcmp (s, "EUC-KR") == 0
just faster. */
@ -163,12 +163,12 @@ streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23,
return 0;
}
#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
#else
#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
(strcmp (s1, s2) == 0)
#endif

View file

@ -40,7 +40,7 @@
extern char *tzname[];
#endif
/* Do multibyte processing if multibytes are supported, unless
/* Do multibyte processing if multibyte encodings are supported, unless
multibyte sequences are safe in formats. Multibyte sequences are
safe if they cannot contain byte sequences that look like format
conversion specifications. The multibyte encodings used by the

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_STRING_H
@ -725,10 +724,14 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mbslen rpl_mbslen
# endif
_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
# else
_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
# endif
_GL_CXXALIASWARN (mbslen);
@ -738,6 +741,7 @@ _GL_CXXALIASWARN (mbslen);
/* Return the number of multibyte characters in the character string starting
at STRING and ending at STRING + LEN. */
_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1));
#endif
@ -751,10 +755,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
# endif
_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
# else
_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
# endif
@ -771,10 +777,12 @@ _GL_CXXALIASWARN (mbschr);
# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
# endif
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
# else
_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
# endif
@ -787,6 +795,7 @@ _GL_CXXALIASWARN (mbsrchr);
Unlike strstr(), this function works correctly in multibyte locales with
encodings different from UTF-8. */
_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@ -798,6 +807,7 @@ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
different lengths!
Unlike strcasecmp(), this function works correctly in multibyte locales. */
_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@ -812,6 +822,7 @@ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
Unlike strncasecmp(), this function works correctly in multibyte locales.
But beware that N is not a byte count but a character count! */
_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@ -825,6 +836,7 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
Unlike strncasecmp(), this function works correctly in multibyte
locales. */
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@ -835,6 +847,7 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
strlen (haystack) < strlen (needle) !
Unlike strcasestr(), this function works correctly in multibyte locales. */
_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@ -845,6 +858,7 @@ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
if none exists.
Unlike strcspn(), this function works correctly in multibyte locales. */
_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@ -858,10 +872,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
# endif
_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
# else
_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
# endif
@ -875,6 +891,7 @@ _GL_CXXALIASWARN (mbspbrk);
if none exists.
Unlike strspn(), this function works correctly in multibyte locales. */
_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@ -994,6 +1011,7 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
#if @GNULIB_STRVERSCMP@
# if !@HAVE_STRVERSCMP@
_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));

View file

@ -1,123 +0,0 @@
/* A substitute <strings.h>.
Copyright (C) 2007-2012 Free Software Foundation, Inc.
This program 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, 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 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _@GUARD_PREFIX@_STRINGS_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
/* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>.
But avoid namespace pollution on glibc systems. */
#if defined __minix && !defined __GLIBC__
# include <sys/types.h>
#endif
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_STRINGS_H@
# @INCLUDE_NEXT@ @NEXT_STRINGS_H@
#endif
#ifndef _@GUARD_PREFIX@_STRINGS_H
#define _@GUARD_PREFIX@_STRINGS_H
#if ! @HAVE_DECL_STRNCASECMP@
/* Get size_t. */
# include <stddef.h>
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
#ifdef __cplusplus
extern "C" {
#endif
/* Find the index of the least-significant set bit. */
#if @GNULIB_FFS@
# if !@HAVE_FFS@
_GL_FUNCDECL_SYS (ffs, int, (int i));
# endif
_GL_CXXALIAS_SYS (ffs, int, (int i));
_GL_CXXALIASWARN (ffs);
#elif defined GNULIB_POSIXCHECK
# undef ffs
# if HAVE_RAW_DECL_FFS
_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
# endif
#endif
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2.
Note: This function does not work in multibyte locales. */
#if ! @HAVE_STRCASECMP@
extern int strcasecmp (char const *s1, char const *s2)
_GL_ARG_NONNULL ((1, 2));
#endif
#if defined GNULIB_POSIXCHECK
/* strcasecmp() does not work with multibyte strings:
POSIX says that it operates on "strings", and "string" in POSIX is defined
as a sequence of bytes, not of characters. */
# undef strcasecmp
# if HAVE_RAW_DECL_STRCASECMP
_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
"strings in multibyte locales - "
"use mbscasecmp if you care about "
"internationalization, or use c_strcasecmp , "
"gnulib module c-strcase) if you want a locale "
"independent function");
# endif
#endif
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
returning less than, equal to or greater than zero if S1 is
lexicographically less than, equal to or greater than S2.
Note: This function cannot work correctly in multibyte locales. */
#if ! @HAVE_DECL_STRNCASECMP@
extern int strncasecmp (char const *s1, char const *s2, size_t n)
_GL_ARG_NONNULL ((1, 2));
#endif
#if defined GNULIB_POSIXCHECK
/* strncasecmp() does not work with multibyte strings:
POSIX says that it operates on "strings", and "string" in POSIX is defined
as a sequence of bytes, not of characters. */
# undef strncasecmp
# if HAVE_RAW_DECL_STRNCASECMP
_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
"strings in multibyte locales - "
"use mbsncasecmp or mbspcasecmp if you care about "
"internationalization, or use c_strncasecmp , "
"gnulib module c-strcase) if you want a locale "
"independent function");
# endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* _@GUARD_PREFIX@_STRING_H */
#endif /* _@GUARD_PREFIX@_STRING_H */

View file

@ -1,63 +0,0 @@
/* strncasecmp.c -- case insensitive string comparator
Copyright (C) 1998-1999, 2005-2007, 2009-2012 Free Software Foundation, Inc.
This program 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, 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 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <config.h>
/* Specification. */
#include <string.h>
#include <ctype.h>
#include <limits.h>
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
returning less than, equal to or greater than zero if S1 is
lexicographically less than, equal to or greater than S2.
Note: This function cannot work correctly in multibyte locales. */
int
strncasecmp (const char *s1, const char *s2, size_t n)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2 || n == 0)
return 0;
do
{
c1 = TOLOWER (*p1);
c2 = TOLOWER (*p2);
if (--n == 0 || c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
if (UCHAR_MAX <= INT_MAX)
return c1 - c2;
else
/* On machines where 'char' and 'int' are types of the same size, the
difference of two 'unsigned char' values - including the sign bit -
doesn't fit in an 'int'. */
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
}

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Richard W.M. Jones. */

View file

@ -14,8 +14,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file is supposed to be used on platforms that lack <sys/socket.h>,
on platforms where <sys/socket.h> cannot be included standalone, and on
@ -143,7 +142,7 @@ struct sockaddr_storage
that you can influence which definitions you get by setting the
WINVER symbol before including these two files. For example,
getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
symbol is set indiriectly through WINVER). You can set this by
symbol is set indirectly through WINVER). You can set this by
adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
code may not run on older Windows releases then. My Windows 2000
box was not able to run the code, for example. The situation is

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
@ -36,7 +35,8 @@
#ifndef _@GUARD_PREFIX@_SYS_STAT_H
/* Get nlink_t. */
/* Get nlink_t.
May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
/* Get struct timespec. */
@ -67,6 +67,11 @@
# include <io.h>
#endif
/* Large File Support on native Windows. */
#if @WINDOWS_64_BIT_ST_SIZE@
# define stat _stati64
#endif
#ifndef S_IFIFO
# ifdef _S_IFIFO
# define S_IFIFO _S_IFIFO
@ -336,6 +341,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
# endif
_GL_CXXALIASWARN (fstat);
#elif @WINDOWS_64_BIT_ST_SIZE@
/* Above, we define stat to _stati64. */
# define fstat _fstati64
#elif defined GNULIB_POSIXCHECK
# undef fstat
# if HAVE_RAW_DECL_FSTAT
@ -616,14 +624,55 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
/* We can't use the object-like #define stat rpl_stat, because of
struct stat. This means that rpl_stat will not be used if the user
does (stat)(a,b). Oh well. */
# undef stat
# ifdef _LARGE_FILES
# if defined _AIX && defined stat && defined _LARGE_FILES
/* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
so we have to replace stat64() instead of stat(). */
# define stat stat64
# undef stat64
# define stat64(name, st) rpl_stat (name, st)
# else /* !_LARGE_FILES */
# elif @WINDOWS_64_BIT_ST_SIZE@
/* Above, we define stat to _stati64. */
# if defined __MINGW32__ && defined _stati64
# ifndef _USE_32BIT_TIME_T
/* The system headers define _stati64 to _stat64. */
# undef _stat64
# define _stat64(name, st) rpl_stat (name, st)
# endif
# elif defined _MSC_VER && defined _stati64
# ifdef _USE_32BIT_TIME_T
/* The system headers define _stati64 to _stat32i64. */
# undef _stat32i64
# define _stat32i64(name, st) rpl_stat (name, st)
# else
/* The system headers define _stati64 to _stat64. */
# undef _stat64
# define _stat64(name, st) rpl_stat (name, st)
# endif
# else
# undef _stati64
# define _stati64(name, st) rpl_stat (name, st)
# endif
# elif defined __MINGW32__ && defined stat
# ifdef _USE_32BIT_TIME_T
/* The system headers define stat to _stat32i64. */
# undef _stat32i64
# define _stat32i64(name, st) rpl_stat (name, st)
# else
/* The system headers define stat to _stat64. */
# undef _stat64
# define _stat64(name, st) rpl_stat (name, st)
# endif
# elif defined _MSC_VER && defined stat
# ifdef _USE_32BIT_TIME_T
/* The system headers define stat to _stat32. */
# undef _stat32
# define _stat32(name, st) rpl_stat (name, st)
# else
/* The system headers define stat to _stat64i32. */
# undef _stat64i32
# define _stat64i32(name, st) rpl_stat (name, st)
# endif
# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */
# undef stat
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
_GL_EXTERN_C int stat (const char *name, struct stat *buf)

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
@ -40,9 +39,11 @@
# include <time.h>
# endif
/* On native Windows with MSVC:
Get the 'struct timeval' type. */
# if defined _MSC_VER && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
/* On native Windows with MSVC, get the 'struct timeval' type.
Also, on native Windows with a 64-bit time_t, where we are overriding the
'struct timeval' type, get all declarations of system functions whose
signature contains 'struct timeval'. */
# if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
# define _GL_INCLUDING_WINSOCK2_H
# include <winsock2.h>
# undef _GL_INCLUDING_WINSOCK2_H
@ -58,7 +59,11 @@
extern "C" {
# endif
# if ! @HAVE_STRUCT_TIMEVAL@
# if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
# if @REPLACE_STRUCT_TIMEVAL@
# define timeval rpl_timeval
# endif
# if !GNULIB_defined_struct_timeval
struct timeval

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@ -29,6 +28,18 @@
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
#define _@GUARD_PREFIX@_SYS_TYPES_H
/* Override off_t if Large File Support is requested on native Windows. */
#if @WINDOWS_64_BIT_OFF_T@
/* Same as int64_t in <stdint.h>. */
# if defined _MSC_VER
# define off_t __int64
# else
# define off_t long long int
# endif
/* Indicator, for gnulib internal purposes. */
# define _GL_WINDOWS_64_BIT_OFF_T 1
#endif
/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
/* But avoid namespace pollution on glibc systems. */
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \

View file

@ -12,8 +12,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@

View file

@ -13,8 +13,7 @@
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */

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