Norihiro Tanaka [Mon, 22 Oct 2018 14:51:20 +0000 (23:51 +0900)]
dfa: a state has a set of current positions.
Up to now, a state had a set of follow-on positions. It is replaced a
set of current positions. This change will save memory space.
dfa.c (leaf_set): Remove it.
(struct dfa): Add new member constraints and separates.
(append): New function.
(state_index): Bring constraint from pre-calculated.
(state_separate_contexts): Bring separate contexts from pre-calculated.
Change argument, update callers.
(merge_nfa_state): Pre-calculate constraints for END. and remove END.
No longer END is not used after here.
(dfaoptimize): Initialize added member constraints.
(dfaanalyze): Pre-calculate seprate contexts.
(build_state): Change for this update.
(dfassbuild): Initialize new members .
(dfafree): Free memory for new members.
Norihiro Tanaka [Mon, 22 Oct 2018 14:31:26 +0000 (23:31 +0900)]
dfa: position set sorts increasing order
Change the order of position set from decreasing to increaing, then even
after dfa is optimized, it is guaranteed that the number of a position
is smaller than the subsequent one's number.
dfa.c (insert, merged_constrained, delete): Reverse the direction of an
inequality sign.
(dfaanalyze): Position set sorts increasing order.
Paul Eggert [Thu, 25 Oct 2018 15:33:59 +0000 (08:33 -0700)]
havelib: fix nested ‘configure’ chatter
* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Don’t nest
AC_CACHE_CHECK calls, which resulted in confusing output like
“checking for the common suffixes of directories in the library
search path... checking for 64-bit host... no lib,lib”.
Paul Eggert [Thu, 25 Oct 2018 15:25:41 +0000 (08:25 -0700)]
backupfile: tweak for better code
* lib/backupfile.c: Sort include directives, and remove
unnecessary <limits.h> include.
(FALLTHROUGH): New macro, copied from other modules.
(backupfile_internal): Use it to avoid code duplication.
This lets GCC 8.2.1 generate better code by inlining the
call to check_extension.
Paul Eggert [Wed, 24 Oct 2018 02:10:21 +0000 (19:10 -0700)]
backupfile: new dir_fd args
New module opendirat with code taken from fts.
Use this module to let backupfile use a directory file descriptor.
* NEWS: Document the incompatible change.
* lib/backup-find.c (find_backup_file_name):
* lib/backup-rename.c (backup_file_rename):
New arg DIR_FD.
* lib/backupfile.c: Include stdint.h, for SIZE_MAX.
(SIZE_MAX): Remove.
Include opendirat.h rather than dirent--.h.
(check_extension): New args DIR_FD and BASE_MAX. All callers changed.
(numbered_backup): New args DIR_FD and PNEW_FD. All callers changed.
(backupfile_internal): New arg DIR_FD. All callers changed.
* lib/fts.c: Include opendirat.h.
(opendirat): Move to opendirat.c.
* lib/opendirat.c, lib/opendirat.h, modules/opendirat: New files.
* modules/backupfile (Depends-on): Remove dirfd, opendir.
Add opendirat.
* modules/fts (Depends-on): Remove fdopendir, openat-safer.
Add opendirat.
Bruno Haible [Mon, 22 Oct 2018 22:06:52 +0000 (00:06 +0200)]
Assume Autoconf >= 2.63.
* DEPENDENCIES: Mention the requirement.
* gnulib-tool (DEFAULT_AUTOCONF_MINVERSION): Bump to 2.63.
(func_get_filelist): Don't list m4/onceonly.m4 any more.
* pygnulib/GLModuleSystem.py (getFiles): Likewise.
* m4/onceonly.m4: Remove file.
Bruno Haible [Mon, 22 Oct 2018 00:38:39 +0000 (02:38 +0200)]
localename: Fine-tune support for per-thread locales on Solaris 11.4.
* lib/localename-table.h: New file, extracted from lib/localename.c.
* lib/localename-table.c: Likewise.
* lib/localename.c: Include localename-table.h.
(get_locale_t_name, newlocale, duplocale, freelocale): Invoke
locale_hash_function instead of pointer_hash.
* modules/localename (Files): Add lib/localename-table.h,
lib/localename-table.c.
(lib_SOURCES): Add localename-table.c.
* m4/intlsolaris.m4 (gt_INTL_SOLARIS): Require AC_CANONICAL_HOST. Test
for Solaris 11.4 locale system only on Solaris. Test for it
independently whether getlocalename_l exists.
* m4/intl.m4 (gt_INTL_SUBDIR_CORE): Don't test for 'uselocale' and
'getlocalename_l'. Instead, invoke gt_INTL_SOLARIS. Set
HAVE_NAMELESS_LOCALES.
* modules/gettext (Files): Add m4/intlsolaris.m4.
Bruno Haible [Mon, 22 Oct 2018 00:34:07 +0000 (02:34 +0200)]
Small update from gettext.
* m4/intl.m4: Update from gettext:
- 2018-01-02: Fix 'ar' invocation when cross-compiling and in 64-bit
mode on AIX.
- 2018-01-02: Don't use -lc explicitly when linking with libtool.
- 2017-05-19: (AM_INTL_SUBDIR): Require AC_C_FLEXIBLE_ARRAY_MEMBER.
Akim Demaille [Fri, 12 Oct 2018 04:46:09 +0000 (06:46 +0200)]
timevar: use gethrxtime to get wall clock time
clock_gettime is not portable. gethrxtime takes the best available
option to get the wall clock time, including clock_gettime (monotonic
clock), and gettime (non monotonic).
Also, using xtime_t instead of float preserves the precision.
Suggested by Bruno Haible.
* lib/xtime.h (xtime_make): Handle overflows of nanoseconds.
* modules/timevar (Depends-on): We need gethrxtime.
We no longer use times().
(Link): Update.
* lib/timevar.h (timevar_time_def): Use xtime_t.
* lib/timevar.c (set_to_current_time): Use gethrxtime.
(timevar_print): Instead of checking whether the timings themselves
are large enough for the timevar to be printed, check the percentages.
Bruno Haible [Sun, 14 Oct 2018 07:21:24 +0000 (09:21 +0200)]
wcsnrtombs: Work around Solaris 11.4 bug.
* m4/wcsnrtombs.m4 (gl_WCSNRTOMBS_WORKS_IN_TRADITIONAL_LOCALE): New
macro.
(gl_FUNC_WCSNRTOMBS): Invoke it.
* doc/posix-functions/wcsnrtombs.texi: Mention the Solaris bug.
Bruno Haible [Sun, 14 Oct 2018 07:19:12 +0000 (09:19 +0200)]
mbsnrtowcs: Work around Solaris 11.4 bug.
* m4/mbsnrtowcs.m4 (gl_MBSNRTOWCS_WORKS_IN_TRADITIONAL_LOCALE): New
macro.
(gl_FUNC_MBSNRTOWCS): Invoke it.
* doc/posix-functions/mbsnrtowcs.texi: Mention the Solaris bug.
* m4/floor.m4 (gl_FUNC_FLOOR_LIBS): Use 'floor' also through a function
pointer.
* m4/ceil.m4 (gl_FUNC_CEIL_LIBS): Use 'ceil' also through a function
pointer.
* m4/trunc.m4 (gl_FUNC_TRUNC): Use 'trunc' also through a function
pointer.
* m4/truncf.m4 (gl_FUNC_TRUNCF): Use 'truncf' also through a function
pointer.
* m4/truncl.m4 (gl_FUNC_TRUNCL): Use 'truncl' also through a function
pointer.
Akim Demaille [Thu, 11 Oct 2018 15:54:35 +0000 (17:54 +0200)]
timevar: expect that getrusage is available
Don't keep both times and getrusage as backend: both are guaranteed by
gnulib, a single one suffices. Using getrusage is open to possibly
tracking other types of resources in the future.
* modules/timevar (Depends-on): Add getrusage.
(configure.ac): Remove gl_TIMEVAR.
(Files): Remove m4/timevar.m4.
* m4/timevar.m4: Remove, rely on gnulib for getrusage.
* lib/timevar.h (timevar_enabled): Clarify documentation.
* lib/timevar.c: Remove all the code about times.
Remove all the CPP guards about getrusage: expect it to be present
(courtesy of gnulib).
Bruno Haible [Fri, 12 Oct 2018 09:12:53 +0000 (11:12 +0200)]
mountlist: Improve support for Solaris in 64-bit mode.
Reported by David Wood <David.Wood@deshaw.com> in
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6816>.
* m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): On Solaris 8 or
newer, define MOUNTED_GETEXTMNTENT instead of MOUNTED_GETMNTENT2.
* lib/mountlist.c: Add code for MOUNTED_GETEXTMNTENT case.
Paul Eggert [Mon, 8 Oct 2018 23:53:59 +0000 (16:53 -0700)]
fts: cleanup after FTS_NOATIME removal
* lib/fts_.h (FTS_VERBATIM, FTS_OPTIONMASK, FTS_NAMEONLY)
(FTS_STOP): Shrink to minimal values. We don’t need to
worry about binary compatibility in Gnulib, and the old way
of doing things had a hole in the user options that caused
FTS_OPTIONMASK to not work as desired.
This reverts commit da4d6974013c822af1498941e32db774b2031765.
We cannot guarantee that O_NOATIME works: e.g. openat fails
with EPERM if the effective user ID of the caller does not match
the owner of the file and the caller is not privileged.
Downstream findutils has never picked up FTS_NOATIME. Discussed at
<https://lists.gnu.org/r/bug-gnulib/2018-09/msg00122.html>.
* lib/fts_.h (FTS_NOATIME): Remove bit flag.
(FTS_OPTIONMASK): Adjust.
* lib/fts.c (diropen, fts_open, fts_build): Likewise.
(fd_ring_check): Likewise.
bootstrap, gnulib-tool: use https instead of insecure rsync
The rsync command does not do any authentication and thus allows
man-in-the-middle attacks. Better use wget over https, although
this is slower.
* build-aux/bootstrap (download_po_files, po_download_command_format):
Don't try using rsync; always use wget over https to fetch PO files.
* gnulib-tool (func_import): Likewise.
* pygnulib/GLImport.py (GLImport.execute): Likewise.
bootstrap, gnulib-tool: correct the translations wget command
Using the -np (--no-parent) option doesn't prevent wget from
traversing the given URL to a default depth of 5, and since
the domain directory contains a href="/latest/" link, this
means that wget searches through all domains anyway and will
also download PO files that are meant for other packages.
When getting the PO files for the nano domain, for example,
you will end up with af.po and ast.po (and many others) too,
but there are no African nor Asturian translations for nano.
So, use the --level option instead, to stop wget from looking
any further than the given URL.
* build-aux/bootstrap (po_download_command_format2): Restrict
recursion to a single level.
* gnulib-tool (func_import): Likewise.
* pygnulib/GLImport.py (GLImport.execute): Likewise.
Bruno Haible [Fri, 5 Oct 2018 19:53:24 +0000 (21:53 +0200)]
raise: Make it possible to namespace the defined symbol.
* lib/raise.c (raise): Undefine only after the replacement function has
been defined.
(raise): Renamed from rpl_raise.
(raise_nothrow): Move to the end of the compilation unit.
Akim Demaille [Tue, 2 Oct 2018 04:19:19 +0000 (06:19 +0200)]
timevar: rely on gnulib modules for time portability.
* modules/timevar (Depends-on): Add sys_time, sys_times, and times.
* m4/timevar.m4: Don't check for clock_t and struct tms,
guaranteed by gnulib.
* lib/timevar.h: Use extern "C" protection.
Include <stdio.h> for FILE.
* lib/timevar.c: Include sys/time.h, sys/times.h unconditionally,
they are guaranteed by gnulib.
Remove uses of clock as (now useless) fallback.
Bruno Haible [Thu, 4 Oct 2018 22:22:57 +0000 (00:22 +0200)]
fcntl: Make it possible to namespace the defined symbol.
* lib/fcntl.c (fcntl): Undefine only after the replacement function has
been defined.
(fcntl): Renamed from rpl_fcntl.
(rpl_fcntl_DUPFD, rpl_fcntl_DUPFD_CLOEXEC): New functions, extracted
from fcntl.
(klibc_fcntl): Move to the end of the compilation unit.
Tom Tromey [Mon, 1 Oct 2018 20:57:45 +0000 (14:57 -0600)]
mkostemp, mkostemps: Fix compilation error in C++ mode on Mac OS X.
Attempting to use the mkostemp module in gdb caused a build failure
when using the C++ namespace feature, because mkostemp was not
declared. On OS X, mkostemp is declared in unistd.h, so this patch
extends the existing special case in stdlib.in.h to cover mkostemp and
mkostemps.
* lib/stdlib.in.h: Include <unistd.h> for mkostemp and mkostemps
on OS X.
hmac-sha512: fix hash for keys > blocksize (128 bytes)
* lib/hmac-sha512.c (hmac_sha512): Set the computed/shortened
key length to that output by sha512, not the blocksize.
Otherwise uninitialized data from the stack
is used when computing the hash.
* tests/test-hmac-sha512.c: Add a shortened key test case.
Reported at https://github.com/coreutils/gnulib/pull/5
Bruno Haible [Sun, 30 Sep 2018 17:27:56 +0000 (19:27 +0200)]
timevar: Include documentation in gnulib manual.
* doc/timevar.texi: Change node and section name to 'Profiling of
program phases'.
In the code snippets, tweak the #includes and use GNU coding style.
* doc/gnulib.texi: Include timevar.texi.
Paul Eggert [Wed, 19 Sep 2018 02:05:26 +0000 (19:05 -0700)]
dfa: tweak allocation performance
* lib/dfa.c (merge_nfa_state, dfaoptimize):
Prefer ptrdiff_t for indexes some more.
Use char for flags, as it’s wide enough.
Allocate queue and flags together, with one malloc call.
No need to use xnmalloc since the multiplication and
addition cannot overflow (it’s already been checked by
earlier allocation). Prefer memset to open-coding.
Paul Eggert [Wed, 19 Sep 2018 01:24:27 +0000 (18:24 -0700)]
dfa: prune states as we go
* lib/dfa.c (prune): Remove.
(merge_nfa_state): Prune as we go instead of at the end.
Prefer ptrdiff_t for indexes, as this helps the compiler a bit.
Simplify constraint checking a bit.