2018-12-20  Jim Meyering  <meyering@fb.com>

	version 3.3
	* NEWS: Record release date.

	grep: fix \b DFA-bug in C locale
	Under some conditions, \b would mistakenly fail to match, e.g.
	  echo 123-x|LC_ALL=C grep '.\bx'
	* NEWS (Bug fixes): Mention it
	* gnulib: Update to latest, for DFA regression fix.
	* tests/word-delim-multibyte: Add a test for the dfa.c regression.

2018-12-20  Paul Eggert  <eggert@cs.ucla.edu>

	grep: fit --version authorship into 80
	* src/grep.c (AUTHORS): Remove.
	(main): Output the authorship info ourselves instead of having
	version_etc do it.  This is better for i18n anyway.

	build: update gnulib submodule to latest

2018-12-20  Jim Meyering  <meyering@fb.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 3.2
	* NEWS: Record release date.

2018-12-18  Jim Meyering  <meyering@fb.com>

	build: update gnulib for c-stack fix

2018-12-17  Bruno Haible  <bruno@clisp.org>

	tests: stack-overflow: avoid unwarranted test failure on some hosts
	* tests/stack-overflow: Use ulimit to limit stack size. Otherwise,
	at least on gcc113, grep would fail to overflow its stack, so this
	test would fail to find the required diagnostic and would fail.

2018-12-16  Jim Meyering  <meyering@fb.com>

	tests: reenable the surrogate-pair test
	This reverts commit bdb98cec2e7bf255e1d00eaf8be16299f7bf571e,
	but adding the comment changes suggested by Bruno Haible in
	https://lists.gnu.org/r/grep-devel/2018-12/msg00037.html
	* tests/surrogate-pair: New file.
	* tests/Makefile.am (TESTS): List it.

2018-12-16  Bruno Haible  <bruno@clisp.org>

	tests: stackoverflow: fix test failure on HardenedBSD 11
	* tests/stack-overflow: Try up to 10 million opening parentheses.

2018-12-16  Jim Meyering  <meyering@fb.com>

	tests: remove stale surrogate-pair test
	The cygwin-specific code for surrogate pairs was first disconnected
	via v2.21-62-g936c904 and later removed as part of a then-unused
	function via v2.24-12-g704de87. So now I'm removing the test, too.
	If someone thinks it important and would like to revive it, please do.
	* tests/surrogate-pair: Remove file.
	* tests/Makefile.am (TESTS): Remove it.

2018-12-16  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2018-12-15  Jim Meyering  <meyering@fb.com>

	tests: stack-overflow: handle the case of success without the diagnostic
	* tests/stack-overflow: Do not always require a stack
	overflow diagnostic.

	build: update gnulib to latest
	* gnulib: Update to latest, to pull in code that now compensates for
	a bug in glibc-2.27 and prior.

	build: make the autoconf-2.63 requirement explicit
	* configure.ac: AC_PREREQ: Require 2.63, not 2.59. And quote properly.
	Autoconf-2.63 has been required for some time via gnulib.
	This merely makes it explicit.

2018-12-15  Paul Eggert  <eggert@cs.ucla.edu>

	tests: fix diagnostic typo
	Fix by Bruno Haible in:
	https://lists.gnu.org/r/grep-devel/2018-12/msg00003.html
	* tests/init.cfg (envvar_check_fail): Fix diagnostic.

2018-11-24  Jim Meyering  <meyering@fb.com>

	tests: stack-overflow: avoid false failure
	* tests/stack-overflow: This test would fail to elicit a stack overflow
	diagnostic on some OS X systems. Rewrite to iterate, gradually increasing
	the size of the input regex, stopping when grep emits the desired diagnostic
	or the size reaches a reasonable limit.

2018-10-16  Jim Meyering  <meyering@fb.com>

	tests: reduce the sole failing test
	* tests/backref-alt: Significantly reduce abort-inducing input.

	build: update gnulib to latest; also update bootstrap and init.sh

2018-10-13  Jim Meyering  <meyering@fb.com>

	doc: NEWS: mention performance improvements
	* NEWS (Improvements): Mention them.

2018-10-13  Jim Meyering  <meyering@fb.com>

	grep: triple initial buffer size: 32k->96k
	Changing 32k to 96k gives a 3-23% performance improvement.
	All timings ran with this diff on top of commit v3.1-39-g7179b21:

	for n in 32 64 96 128; do
	  echo n=$n
	  perl -pi -e 's/(INITIAL_BUFSIZE =) \d+/$1 '$n/ src/grep.c &&
	    make AM_CFLAGS=-O3 WERROR_CFLAGS= >& makerr-$n &&
	    for needle in 1f2 1f298lkjskjhahjklkj34; do
	      echo "  needle=$needle"
	      for i in $(seq 10); do
	         env MALLOC_PERTURB_= time -qf%e src/grep $needle w2000
	      done 2>&1 |sort -g | tee >(head -1|sed 's/^/    /') > .time-${n}KB-$needle
	    done
	done

	Tested searchs: search for a short literal pattern that is not
	present in 9.3GB file containing 2000 copies of /usr/dict/words
	created via this:
	  ln -s /usr/share/dict/words k && cat $(yes k|head -2000) > w2000
	I ran this command:
	  env MALLOC_PERTURB_= time src/grep 1f2 w2000
	old(32k) vs new elapsed time, best of 10 trials (gcc-9.0.0 20180831, -O3):
	 32k  64k  96k(%incr) 128k CPU
	1.25 1.18 1.16( 7.2) 1.20 i7-4770S@3.10GHz cache=8MB
	1.21 1.16 1.17( 3.3) 1.19 Xeon(R) E3-1505M v5 @ 2.80GHz cache=8MB
	2.36 2.29 2.29( 3.0) 2.36 Xeon(R) E5-2680 v4 @ 2.40GHz cache=32MB
	1.40 1.32 1.31( 6.4) 1.33 i5-6260U @ 1.80GHz cache=4MB
	1.31 1.26 1.24( 5.3) 1.23 AMD FX(tm)-4100 cache=2MB (with only 1000 copies)

	Searching for a longer string: 1f298lkjskjhahjklkj34
	2.03 1.76 1.61(20.7) 1.53 i7-4770S@3.10GHz cache=8MB
	1.95 1.70 1.56(20.0) 1.51 Xeon(R) E3-1505M v5 @ 2.80GHz
	3.27 2.98 2.84(13.1) 3.02 Xeon(R) E5-2680 v4 @ 2.40GHz
	2.48 2.12 1.91(23.0) 1.80 i5-6260U @ 1.80GHz cache=4MB
	1.72 1.54 1.46(15.1) 1.41 AMD FX(tm)-4100 cache=2MB

	* src/grep.c (INITIAL_BUFSIZE): Triple it: 32kB -> 96kB

2018-09-28  Barret Rhoden  <brho@cs.berkeley.edu>  (tiny change)

	maint: fix cross-compiling problem
	* cfg.mk (PATH): Omit if cross-compiling (Bug#32866).

2018-09-28  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

	grep: fix usage 80-column glitch
	* src/grep.c (usage): Do not go over 80 columns in the source
	code, to pacify "make dist".

2018-09-19  Paul Eggert  <eggert@cs.ucla.edu>

	maint: update bootstrap
	* bootstrap: Copy from Gnulib.

	maint: fix build failure
	Problem found by OpenCSW buildbot; the bug also occurs on GNU/Linux
	build platforms.  The symptom is “system.h:26:24: fatal error:
	configmake.h: No such file or directory”.  See:
	https://buildfarm.opencsw.org/buildbot/builders/ggrep-solaris10-sparc/builds/107
	* bootstrap.conf: Add configmake, a dependency that was formerly brought
	in only by accident.

2018-09-18  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2018-08-09  Paul Eggert  <eggert@cs.ucla.edu>

	tests: fix comment

	tests: backref-alt works with glibc 2.28
	Problem reported by Jaroslav Skarvada (Bug#32409).
	* tests/Makefile.am (XFAIL_TESTS) [!USE_INCLUDED_REGEX]:
	Don’t add backref-alt, since this bug is fixed in glibc 2.28.

2018-05-11  Paul Eggert  <eggert@cs.ucla.edu>

	doc: “pattern” vs “patterns”
	* doc/grep.in.1, doc/grep.texi, src/grep.c (usage): Be more
	careful about saying that an argument or option specifies one or
	more patterns, not just a single pattern.  Problem reported by Kaz
	Kylheku (Bug#31400).

	build: update gnulib submodule to latest

2018-04-21  Jim Meyering  <meyering@fb.com>

	maint: fix new syntax-check (sc_long_lines) failure
	* HACKING: Shorten line by one byte to fit in 80 columns.

	build: update gnulib to latest

2018-04-21  Paul Eggert  <eggert@cs.ucla.edu>

	doc: fix font typo

	maint: update URLs
	Mostly this is just changing http: to https:.
	In one or two places it removes no-longer-useful URLs.

	doc: man-page format fixes
	* doc/grep.in.1: Fix minor formatting glitches, e.g., extra
	space after [...] because groff thought it was a sentence end.
	Problem reported by Ingo Schwarze (Bug#31228#11).

2018-04-20  Paul Eggert  <eggert@cs.ucla.edu>

	doc: mention encoding errors
	This attempts to document the encoding-error problem more
	precisely (Bug#30326).
	* doc/grep.in.1, doc/grep.texi: Mention that the behavior of
	patterns like ‘.’ is not specified on encoding errors.

	doc: port better to mandoc
	* doc/grep.in.1: Check for groff and its macro packages
	independently, as groff can be used with non-groff macro packages.
	Use an-ext style macros rather than www.tmac style, as this should
	be more portable to mandoc.  Problem reported by Laura Morales and
	Ingo Schwarze (Bug#31228).

2018-02-16  Jim Meyering  <meyering@fb.com>

	maint: avoid new syntax-check failure
	* cfg.mk (old_NEWS_hash): Update, to accommodate v3.1-20-g63d4174's
	typo fix.

	doc: clarify that PCRE support is here to stay
	* doc/grep.texi (grep Programs): Clarify: it's not PCRE support
	that is experimental, but its combination with --null-data (-z).

2018-02-05  Paul Eggert  <eggert@cs.ucla.edu>

	maint: fix typo

2018-01-06  Jim Meyering  <meyering@fb.com>

	maint: update gnulib and copyright dates for 2018
	* gnulib: Update to latest.
	* all files: Run "make update-copyright".
	* bootstrap: Update from gnulib.

2017-12-17  Jim Meyering  <meyering@fb.com>

	build: link with -lsigsegv, when c-stack module requires it
	* src/Makefile.am (grep_LDADD): Add $(LIBCSTACK).
	Otherwise, on at least Debian and Arch-based systems, linking would
	fail with diagnostics like these:
	  c-stack.c:207: undefined reference to `stackoverflow_install_handler'
	  c-stack.c:216: undefined reference to `sigsegv_install_handler'
	Reported by Jeremy Feusi.

	build: suppress sig-handler.h's -Wcast-function-type warning
	* configure.ac (WERROR_CFLAGS): Add -Wno-cast-function-type
	to suppress warning about sig-handler.h's sa_handler_t cast:
	sig-handler.h: In function 'get_handler':
	sig-handler.h:47:12: error: cast between incompatible function\
	  types from 'void (* const)(int,  siginfo_t *, void *)'\
	  {aka 'void (* const)(int,  struct <anonymous> *, void *)'}\
	  to 'void (*)(int)' [-Werror=cast-function-type]
	     return (sa_handler_t) a->sa_sigaction;

2017-12-16  Jim Meyering  <meyering@fb.com>

	grep: diagnose stack overflow rather than segfaulting
	* bootstrap.conf (gnulib_modules): Add c-stack.
	* src/grep.c: Include "c-stack.h".
	(main): Call c_stack_action (NULL);
	* tests/stack-overflow: New file.
	* tests/Makefile.am (TESTS): Add name of new file.
	* NEWS (Improvements): Mention it.
	Interestingly, this bug does not afflict grep-2.5.4 or prior,
	so it appeared to have been introduced with grep-2.6.  However,
	the origin is in glibc's regexp compiler, and I tracked it to
	stack-aware parsing that was removed from glibc's regexp in 2002.
	However, grep-2.5.4 was released in 2009.  That version worked
	(and still works, now) because it included and (by default) used
	an old copy of glibc's regexp code.
	Jeremy Feusi reported the grep segfault in https://bugs.gnu.org/29666.
	I reported the glibc regexp bug in
	https://sourceware.org/bugzilla/show_bug.cgi?id=22620

2017-11-26  Stephan T. Lavavej  <stl@nuwen.net>

	grep: fix directory recursion on MS-Windows
	gnulib recently gained a module, windows-stat-inodes, that fixes
	directory recursion on MS-Windows. No changes to grep's C sources are
	required; grep simply needs to request the module during configuration.

	When grep requests this module, its configure script will gain the
	behavior that was implemented in windows-stat-inodes.m4. This detects
	mingw and sets WINDOWS_STAT_INODES=1. All other platforms are
	unaffected, setting WINDOWS_STAT_INODES=0 (which is what's happening
	in the absence of this patch).

	* bootstrap.conf (gnulib_modules): Add windows-stat-inodes.
	* NEWS (Bug fixes): Mention it.
	Thanks to Pär Björklund who diagnosed the problem as involving inodes,
	and thanks to Václav Haisman who provided the bootstrap.conf patch.

2017-11-25  Paul Eggert  <eggert@cs.ucla.edu>

	grep: port better to Adélie GNU/Linux 64-bit ppc
	Problem reported by A. Wilcox (Bug#29446).
	* src/pcresearch.c (PCRE_EXTRA_MATCH_LIMIT_RECURSION)
	(PCRE_STUDY_EXTRA_NEEDED): Default to 0.
	(jit_exec): If we run up against the recursion limit,
	double it (if possible) and try again.
	(Pcompile): Also specify PCRE_STUDY_EXTRA_NEEDED so that
	pc->extra is not null.

2017-11-03  Paul Eggert  <eggert@cs.ucla.edu>

	grep: omit a dup 'const'
	* src/grep.c (matchers): Omit duplicate 'const'.

2017-10-13  Bernhard Voelker  <mail@bernhard-voelker.de>

	doc: document the option delimiter '--'
	* doc/grep.texi (Other options): Do the above.
	Reported in https://lists.opensuse.org/opensuse/2017-03/msg00411.html
	This addresses http://bugs.gnu.org/26139

2017-08-21  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

	Pacify GCC 5.4
	* src/grep.c (grepdesc): Rework to pacify GCC 5.4 warning
	about logical not.

2017-08-20  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2017-08-17  Paul Eggert  <eggert@cs.ucla.edu>

	grep: -L exits with status 0 if a file is selected
	Problem reported by Anthony Sottile (Bug#28105).
	* NEWS, doc/grep.texi (Exit Status), src/grep.c (usage): Document this.
	* src/grep.c (grepdesc): Implement it.
	* tests/skip-read: Test it.

	build: update gnulib submodule to latest

2017-08-13  Jim Meyering  <meyering@fb.com>

	maint: avoid newly-introduced syntax-check failure
	* src/grep.c (usage): Shorten --help line to 80, so
	"make syntax-check" passes once again.

2017-08-03  Paul Eggert  <eggert@cs.ucla.edu>

	doc: improve -o help
	* src/grep.c (usage): Document that -o outputs only nonempty
	matches (Bug#27931).

2017-07-26  Paul Eggert  <eggert@cs.ucla.edu>

	tests: add Bug#27838 test case
	* tests/backref-alt: New test case from a fuzzer.

2017-07-25  Paul Eggert  <eggert@cs.ucla.edu>

	doc: distinguish -w from \<...\>
	* doc/grep.texi (Matching Control):
	Give example of why -w differs from \<...\> (Bug#27813).

2017-07-11  Paul Eggert  <eggert@cs.ucla.edu>

	doc: define Dt string in man page
	Problem reported by Bjarni I. Gislason via Santiago R.R. (Bug#27651).
	* doc/grep.in.1 (dT): New macro.
	(Dt): Define this string.

2017-07-02  Jim Meyering  <meyering@fb.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 3.1
	* NEWS: Record release date.

2017-07-01  Jim Meyering  <meyering@fb.com>

	tests: avoid false failures when run in qemu user mode
	* tests/filename-lineno.pl: Derive the program name that grep
	will use in diagnostics, based on a suggestion from Assaf Gordon.
	* tests/in-eq-out-infloop: Similar: accept an arbitrary "command_name: "
	prefix on checked diagnostics, rather than requiring "grep: ".
	* tests/reversed-range-endpoints: Likewise.
	* tests/write-error-msg: Likewise.
	Reported by Bruno Haible in http://bugs.gnu.org/27532

2017-06-25  Jim Meyering  <meyering@fb.com>

	gnulib: update to latest
	* gnulib: Update to latest for these portability fixes:
	- stat: port to xlc 12.01
	- xalloc-oversized: port to icc

	doc: fix another typo
	* doc/grep.texi (File and Directory Selection): Fix typo: s/afer/after/

2017-06-24  Jim Meyering  <meyering@fb.com>

	doc: stop calling --perl-regexp (-P) "highly" experimental
	Use wording that is less likely to make readers think that
	support for -P may be removed.
	* doc/grep.in.1: s/highly experimental/experimental/
	* doc/grep.texi: Likewise.
	Suggested by Evan Sheahan.

2017-06-21  Jim Meyering  <meyering@fb.com>

	doc: correct typo
	* doc/grep.texi (Performance): s/suprisingly/surprisingly/

	gnulib: update to latest

2017-06-21  Paul Eggert  <eggert@cs.ucla.edu>

	grep: -m no longer cuts off trailing context
	Problem reported by Markus Jochim (Bug#26254).
	* NEWS, doc/grep.texi (General Output Control): Document this.
	* src/grep.c (prpending): Selected lines no longer cut off context.
	(usage): Say "selected" instead of "matching", where appropriate.
	* tests/foad1, tests/max-count-vs-context, tests/yesno:
	Adjust to match new behavior.

2017-05-31  Paul Eggert  <eggert@cs.ucla.edu>

	Document grep performance
	* doc/grep.texi (Performance): New section.

	build: update gnulib submodule to latest

2017-05-21  Jim Meyering  <meyering@fb.com>

	maint: make the announcement template Cc the devel- list
	* cfg.mk (announcement_Cc_): Define.

	gnulib: update to latest; and update tests/init.sh

	maint: accommodate GCC7's -Werror=duplicated-branches
	* src/system.h (IGNORE_DUPLICATE_BRANCH_WARNING): Define.
	* src/grep.c (grepfile): Use it.
	* src/kwset.c (bmexec, acexec): Use it.

	maint: update to work with GCC7's -Werror=implicit-fallthrough=
	* src/system.h (FALLTHROUGH): Define.
	* src/grep.c (context_length_arg): Use new FALLTHROUGH macro in place
	of comments
	(fgrep_to_grep_pattern, try_fgrep_pattern, main): Likewise.

2017-05-13  Jim Meyering  <meyering@fb.com>

	gnulib: update to latest and adapt src/kwset.c
	* gnulib: Update to latest.
	* src/kwset.c: Include "verify.h" for use of assume.

2017-03-22  Jim Meyering  <meyering@fb.com>

	gnulib: update to latest for dfa [0-9] performance improvement
	This pulls in the following change that is very relevant to grep:

	    commit 6afba02d7869d39ed7f61981045ddbdcb2814101
	    Author: Paul Eggert <eggert@cs.ucla.edu>
	    dfa: make [0-9] faster in non-C locales

	* gnulib: Update to latest.
	* NEWS (Improvements): Describe the effect on grep.

2017-03-05  Jim Meyering  <meyering@fb.com>

	build: use $(builddir), not $(srcdir)
	* cfg.mk (PATH): Use $(builddir), so this also takes effect
	in a non-srcdir build.  Also, switch ${PATH} syntax to $(PATH).

2017-03-05  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	build: use $(PATH_SEPARATOR), not ":" to augment PATH
	* cfg.mk (PATH): Use $(PATH_SEPARATOR), for those systems that
	use something other than ":".
	* THANKS.in: Remove name, to avoid syntax-check failure due to
	the duplicate, now that there is this commit.

2017-02-17  Jim Meyering  <meyering@fb.com>

	maint: fix distcheck failure: remove stale dosbuf.c reference
	* src/Makefile.am (EXTRA_DIST): Do not attempt to distribute
	the recently deleted file, dosbuf.c.

	maint: fix new syntax-check errors
	* po/POTFILES.in: Add lib/xbinary-io.c.
	* cfg.mk (FILTER_LONG_LINES): Add TODO to the list of exempt files.

2017-02-16  Paul Eggert  <eggert@cs.ucla.edu>

	Fix up recent -U patches
	Inspired by a suggestion by Eric Blake (Bug#25707#17).
	* bootstrap.conf (gnulib_modules): Add xbinary-io,
	and remove binary-io and xfreopen.
	* doc/grep.texi (Other Options):
	Fix typo and reword to be a bit more general.
	* src/grep.c: Include xbinary-io.h instead of xfreopen.h.
	(grepfile): Open with O_BINARY if binary.
	(grepdesc): No need for set_binary_mode now.
	(grep_command_line_arg, main): Set stdin to binary mode if binary.
	(main): Avoid unnecessary test of stdin == NULL.
	Use xsetmode instead of xfreopen.
	* src/system.h: Do not include binary-io.h.

	build: update gnulib submodule to latest

	Simplify -U on MS-Windows by removing guesswork
	Suggested by Eric Blake (Bug#25707#11).
	* NEWS, doc/grep.texi: Document this.
	* src/dosbuf.c: Remove.
	* bootstrap.conf (gnulib_modules): Add xfreopen.
	* src/grep.c: Include xfreopen.h, not dosbuf.c.
	(fillbuf, print_line_head): Do not undossify input.
	(binary): New static var.
	(grepdesc): Apply BINARY to input file.
	(usage): Remove -u help.
	(main): Set BINARY if -U, and apply it to stdout.  Do nothing if -u.
	With -f, apply BINARY to input file.

2017-02-16  Eric Blake  <eblake@redhat.com>

	grep: don't forcefully strip carriage returns
	Commit 5c92a54 made the mistaken assumption that using fopen("rt")
	on platforms where O_TEXT is non-zero makes sense.  However, POSIX
	already requires fopen("r") to open a file in text mode, vs.
	fopen("rb") when binary mode is wanted, and at least on Cygwin,
	where it is possible to control whether a mount point is binary
	or text by default (using just "r"), the use of fopen("rt") actively
	breaks assumptions on a binary mount by silently corrupting any
	carriage returns that are supposed to be preserved.

	* src/grep.c (main): Never use fopen("rt") (Bug#25707).

2017-02-13  Paul Eggert  <eggert@cs.ucla.edu>

	Update TODO and doc
	* TODO: Bring up-to-date and fix formatting glitches.
	* doc/grep.in.1, doc/grep.texi: Fix minor glitches.
	The above patches should address the same problems that recent
	Debian doc patches address, albeit in a different way.

2017-02-12  Paul Eggert  <eggert@cs.ucla.edu>

	doc: clarify default input (Bug#25651)
	* doc/grep.in.1:
	* src/grep.c (usage): Clarify default input when -r.
	* src/grep.c (usage): Do not bother documenting egrep and fgrep;
	the manual is enough.

2017-02-09  Jim Meyering  <meyering@fb.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 3.0
	* NEWS: Record release date.

2017-02-08  Paul Eggert  <eggert@cs.ucla.edu>

	grep: do not mishandle \. in multiple patterns
	Problem reported by Lars Wendler (Bug#25655).
	* NEWS: Document this.
	* src/grep.c (try_fgrep_pattern): Fix typo that prevented
	keys from being properly updated.
	* tests/foad1: Test for the bug.

2017-02-07  Paul Eggert  <eggert@cs.ucla.edu>

	Do not assume PCRE 8.20 or later
	Problem reported by Zube (Bug#25647)
	* NEWS: Document this.
	* src/pcresearch.c (struct pcre.com.jit_stack):
	Declare only if PCRE_STUDY_JIT_COMPILE.

2017-02-06  Jim Meyering  <meyering@fb.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 2.28
	* NEWS: Record release date.

2017-02-02  Jim Meyering  <meyering@fb.com>

	gnulib: update to latest

2017-02-01  Paul Eggert  <eggert@cs.ucla.edu>

	grep: tune to avoid memchr2 sometimes
	Problem noted by Norihiro Tanaka in:
	http://lists.gnu.org/archive/html/grep-devel/2017-01/msg00027.html
	Although not enough to restore all the previous performance in the
	case he noted, it helps significantly.
	* src/kwset.c (memchr_kwset): Bring back small_heuristic,
	in a somewhat different form.

2017-01-29  Jim Meyering  <meyering@fb.com>

	gnulib: update to latest

2017-01-23  Paul Eggert  <eggert@cs.ucla.edu>

	grep: simplify recent kwset change
	* src/kwset.c (acexec_trans): Simplify.

2017-01-23  Jim Meyering  <meyering@fb.com>

	tests: really add the new test name
	* tests/Makefile.am (TESTS): Add fgrep-longest.

2017-01-21  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep -Fo could report a match that is not the longest
	* src/kwset.c (acexec): Fix it.
	* tests/fgrep-longest: New test.
	* tests/Makefile.am: Add the test.
	* NEWS: Mention it.

2017-01-18  Paul Eggert  <eggert@cs.ucla.edu>

	grep: speed up Aho-Corasick when at most 2 bytes
	When using Aho-Corasick and all matched strings either begin with
	the same byte, or begin with one of at most two bytes, use memchr2
	to search for these matching bytes and apply the Aho-Corasick
	algorithm only when a memchr2 match is found.  On my platform,
	this speeds up 'grep -F -e aa -e ba in' by a factor of 7, where
	the file 'in' was created by 'seq -f %040.0f 10000000 >in'.
	* src/kwset.c (struct kwset.gc1): Now int, not char.
	If negative, there is no single terminal byte.  All uses changed.
	(struct kwset.gc1help): Now int, not char.
	If negative, memchr2 cannot be used.
	(kwsprep): Set up gc1 and gc1help from kwset->next, with
	the new (slightly changed) interpretation.
	(memchr_kwset): Use memchr2 if possible.
	Adjust to match new meaning of gc1, gc1help.
	(memoff2_kwset): Remove; no longer needed.
	(acexec_trans): Use memchr_kwset when possible, for speed.
	It now supersedes memoff2_kwset.

	grep: remove Commentz-Walter code
	This code was not being used, and complicated maintenance.
	We can bring it back from the repository if it turns out
	to be useful later.
	* src/kwset.c (struct kwset.reverse): Remove.  All uses of
	FOO->reverse replaced by (FOO->kwsexec == bmexec).
	(kwsalloc): Remove 'reverse' arg, as callers outside this
	module do not care about algorithm choice.  All callers changed.
	(kwsprep): When deciding whether to use Boyer-Moore, do not worry
	about being called twice on the same kwset, as that is not allowed.
	(cwexec): Remove; it was never called.  All uses removed.

2017-01-17  Jim Meyering  <meyering@fb.com>

	maint: avoid new syntax-check failures
	* src/kwset.c (struct kwset): Split a line longer than 80.
	* bootstrap: Update from gnulib. This fixes a new syntax-check
	failure due to its use of "time stamp".

2017-01-17  Paul Eggert  <eggert@cs.ucla.edu>

	* NEWS: Fix typo.

	* src/kwset.c: Fix comment typo.

	Improve -i performance in typical UTF-8 searches
	Currently ‘grep -i i’ is slow in a UTF-8 locale, because ‘i’ in
	the pattern matches the two-byte character 'ı' (U+0131, LATIN
	SMALL LETTER DOTLESS I) in data, and kwset handles only
	single-byte character translations, so grep falls back on a slower
	DFA-based search for all searches.  Improve -i performance in the
	typical case by using kwset when data are free of troublesome
	characters like 'ı', falling back on the DFA only when data
	contain troublesome characters.
	* src/dfasearch.c (GEAcompile):
	* src/grep.c (compile_fp_t):
	* src/kwsearch.c (Fcompile):
	* src/pcresearch.c (Pcompile):
	Pattern arg is now char *, not char const *, since Fcompile
	now reallocates it sometimes.
	* src/grep.c (all_single_byte_after_folding): Remove.
	All callers removed.
	(fgrep_icase_charlen): New function.
	(fgrep_icase_available, try_fgrep_pattern):
	Use it, for more-generous semantics.
	(fgrep_to_grep_pattern): Now extern.
	(main): Do not free keys, since Fexecute may use them.
	* src/kwsearch.c (struct kwsearch): New struct.
	(Fcompile): Return it.  If -i, be more generous about patterns.
	(Fexecute): Use it.  Fall back on DFA when the data contain
	troublesome characters; this should be rare in practice.
	* src/kwset.c, src/kwset.h (kwswords): New function.

	build: update gnulib submodule to latest

2017-01-15  Paul Eggert  <eggert@cs.ucla.edu>

	dfa: prefer ptrdiff_t to size_t
	The code already cannot handle objects with size greater than
	SIZE_MAX / 2, so be more honest about it and use ptrdiff_t instead
	of size_t.  ptrdiff_t arithmetic is signed, which allows for more
	checking via -fsanitize=undefined.  It also makes the code a tad
	smaller on x86-64, since it can test for < 0 rather than for ==
	SIZE_MAX.
	* src/dfasearch.c (struct dfa_comp.kwset_exact_matches):
	(kwsmusts, EGexecute):
	* src/kwsearch.c (Fcompile, Fexecute):
	* src/kwset.c (struct kwset.kwsexec, kwsincr, memchr_kwset)
	(memoff2_kwset, bmexec_trans, bmexec, cwexec, acexec_trans)
	(acexec, kwsexec):
	* src/kwset.h (struct kwsmatch.index, .offset, .size):
	Prefer ptrdiff_t to size_t where either will do.

2017-01-11  Paul Eggert  <eggert@cs.ucla.edu>

	grep: improve comments, mostly in kwset
	Remove kwset.h comments that are obsolete and seemingly not
	maintained anyway; people can look in kwset.c instead.
	Update comments to reflect current behavior better.
	Cite Faro & Lecroq 2013.  Use GNU style for end-of-sentence.

2017-01-01  Jim Meyering  <meyering@fb.com>

	maint: update gnulib and copyright dates for 2017
	* gnulib: Update to latest.
	* all files: Run "make update-copyright".

2016-12-31  Paul Eggert  <eggert@cs.ucla.edu>

	grep: speed up -x with many patterns
	* src/kwsearch.c (Fcompile): Improve buffer allocation overhead
	with -x and multiple patterns.  In the common case where '\n' is
	the end-of-line byte, avoid copying other than the first and last
	patterns.

2016-12-31  Jim Meyering  <meyering@fb.com>

	gnulib: update to latest, fixing a parallel getopt test failure

2016-12-29  Paul Eggert  <eggert@cs.ucla.edu>

	maint: space before paren

	grep: int cleanup in kwset.c
	This should affect only theoretical bugs with very large inputs.
	On my platform, this patch shrinks the grep text by 136 bytes.
	* src/kwset.c: Include intprops.h, for INT_MULTIPLY_WRAPV.
	(struct trie, struct kwset, kwsalloc, kwsincr, treedelta, kwsprep)
	(bm_delta2_search, bmexec_trans, cwexec): Prefer ptrdiff_t to int
	when counts can exceed INT_MAX in large inputs, at least in theory.
	(hasevery): Use bool for booleans.
	(bmexec_trans): Avoid undefined behavior on integer overflow.

2016-12-27  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep: improve performance with multiple patterns
	* src/grep.c (main): Avoid fgrep-to-grep conversion for word matching
	with multiple patterns in single byte locales.

2016-12-27  Paul Eggert  <eggert@cs.ucla.edu>

	* NEWS: Fix typo.

	grep: fix bug with '... | grep pat >> /dev/null'
	Problem reported by Benno Fünfstück (Bug#25283).
	* NEWS: Document this.
	* src/grep.c (drain_input) [SPLICE_F_MOVE]:
	Don't assume /dev/null is always acceptable output to splice.
	* tests/grep-dev-null-out: Test for the bug.

2016-12-26  Paul Eggert  <eggert@cs.ucla.edu>

	grep: minor performance tweak for pure functions
	* src/search.h (wordchars_size, wordchar_next, wordchar_prev):
	Declare to be pure.

2016-12-25  Zev Weiss  <zev@bewilderbeest.net>

	grep: move localeinfo to grep.c
	It's not really dfasearch-specific, and grep.c initializes it, so it
	seems like the most appropriate "owner".

	* src/dfasearch.c (localeinfo): Remove.
	* src/grep.c (localeinfo): Add.
	* src/search.h (localeinfo): Move to new commented section.

2016-12-25  Zev Weiss  <zev@bewilderbeest.net>

	pcresearch: thread safety
	* src/pcresearch.c (pcre_comp): New struct to hold previously-global
	state.
	(jit_exec): Operate on a pcre_comp parameter instead of global state.
	(Pcompile): Allocate and return a pcre_comp instead of setting global
	variables.
	(Pexecute): Operate on a pcre_comp parameter instead of global state.

	kwsearch: thread safety
	* src/kwsearch.c (Fcompile): Return a kwset_t instead of setting a
	global variable.
	(Fexecute): Use a passed-in kwset_t instead of a global variable.
	(kwset): Remove global variable.

	dfasearch: thread safety
	* src/dfasearch.c (struct dfa_comp): New struct to hold
	previously-global variables.
	(dfawarn): Remove static variable.
	(kwsmusts): Operate on a dfa_comp parameter instead of global
	variables.
	(GEAcompile): Allocate and return a dfa_comp struct instead of setting
	global variables.
	(EGexecute): Operate on a dfa_comp parameter instead of global
	variables.
	* src/searchutils.c (kwsinit): Replace a static array with a
	dynamically-allocated one.

2016-12-25  Zev Weiss  <zev@bewilderbeest.net>

	grep: prepare search backends for thread-safety
	To facilitate removing mutable global state from search backends,
	compile() functions will return an opaque pointer to backend-specific
	data, which must then be passed back into the corresponding execute()
	function.  This is merely a preparatory step changing function
	signatures and call sites, so the pointers passed & returned are
	dummies for now and not (yet) actually used.

	* src/grep.c (compile_fp_t): Now returns an opaque pointer (the
	compiled pattern).
	(execute_fp_t): Now passed the pointer returned by a compile_fp_t.
	All call sites updated accordingly.
	(compiled_pattern): New static variable.
	* src/dfasearch.c (GEAcompile): Return a void pointer (dummy NULL).
	(EGexecute): Receive a void pointer argument (unused).
	* src/kwsearch.c (Fcompile): Return a void pointer (dummy NULL).
	(Fexecute): Receive a void pointer argument (unused).
	* src/pcresearch.c (Pcompile): Return a void pointer (dummy NULL).
	(Pexecute): Receive a void pointer argument (unused).
	* src/search.h: Update compile/execute function prototypes.

2016-12-24  Jim Meyering  <meyering@fb.com>

	maint: fix "syntax-check" failure
	* src/grep.c (SEP_STR_GROUP): Declare "static".

2016-12-23  Paul Eggert  <eggert@cs.ucla.edu>

	grep: fix comment in searchutils.c

	grep: improve word checking with UTF-8
	* src/searchutils.c: Do not include <verify.h>.
	(word_start): Remove, replacing with ...
	(sbwordchar): New static var.  All uses changed.
	(wordchar_prev): Return size_t, not bool, as this generates
	slightly better code.  Go back faster if UTF-8.

	grep: standardize on localeinfo.multibyte
	* src/dfasearch.c (EGexecute):
	* src/grep.c (main):
	* src/kwsearch.c (Fexecute):
	* src/pcresearch.c (Pcompile):
	Prefer localeinfo.multibyte to (MB_CUR_MAX > 1).

	grep: speed up -wf in C locale
	Problem reported by Norihiro Tanaka (Bug#22357#100).
	This patch improves the performance on that benchmark on my
	platform so that grep is now only about 2x slower than grep 2.26,
	which means it is considerably faster than grep 2.25 and earlier.
	* src/kwsearch.c (Fexecute):
	Use wordchars_size to boost performance for this case.
	* src/search.h, src/searchutils.c (wordchars_size): New function.

	grep: specialize word-finding functions
	This improves performance a bit.
	* src/dfasearch.c, src/kwsearch.c (wordchar):
	Remove; now in searchutils.c.
	* src/grep.c (main): Call wordinit if -w.
	* src/search.h: Adjust.
	* src/searchutils.c: Include verify.h.
	(word_start): New static var.
	(wordchar): Move here from dfasearch.c and kwsearch.c.
	(wordinit, wordchars_count, wordchar_next, wordchar_prev):
	New functions.
	(mb_prev_wc, mb_next_wc): Remove.
	All callers changed to use the new functions instead.

	grep: simplify Fexecute
	* src/kwsearch.c (Fexecute): Avoid the need for a 'try' local or
	for a 'goto success'.  Update mb_start to reflect newline found.

	grep: remove C label
	* src/kwsearch.c (Fexecute): Remove label.

	maint: rewrite to avoid some macros
	These days, the dangerous powers of C macros are not needed if
	constants or functions will do just as well.
	* src/grep.c (SEP_CHAR_SELECTED, SEP_CHAR_REJECTED, SEP_STR_GROUP)
	(INITIAL_BUFSIZE):
	* src/kwset.c (DEPTH_SIZE):
	Now constants, not macros.
	* src/kwset.c (link): Remove macro. Instead, rename local vars
	from 'link' to 'cur'.
	(malloc) [GREP]: Remove macro.  All uses of malloc changed to xmalloc.
	Omit double-inclusion of xalloc.h.  Do not depend on 'GREP'.
	(U): Now a function, not a macro.
	* src/kwset.c, src/searchutils.c (NCHAR): Move this macro to ...
	* src/system.h: ... here, and make it a constant.

2016-12-20  Paul Eggert  <eggert@cs.ucla.edu>

	grep: fix performance with multiple patterns
	Problem reported by Jaroslav Skarvada (Bug#22357).
	* NEWS: Document this and other recent performance fixes.
	* src/grep.c (E_MATCHER_INDEX): New constant.
	(all_single_byte_after_folding):
	New function, split out from fgrep_icase_available.
	(fgrep_icase_available): Use it.
	(try_fgrep_pattern): New function, which also uses it.
	(main): With two or more patterns, use try_fgrep_pattern to fix
	performance regression.  The number "two" here is just a heuristic.

	grep: simplify matcher configuration
	* src/grep.c (matcher, compile): Remove static vars.
	(compile_fp_t): Now takes a 3rd syntax argument.
	(Gcomppile, Ecompile, Acompile, GAcompile, PAcompile): Remove.
	(struct matcher): Now nameless, since it is used only once.
	Make 'name' a bit shorter.  New member 'syntax'.
	(matchers): Initialize it, and change removed functions to GEAcompile.
	(F_MATCHER_INDEX, G_MATCHER_INDEX): New constants.
	(setmatcher): New arg MATCHER, and return new matcher index.
	Avoid unnecessary call to strcmp.
	(main): Keep matcher as a local int, not a global pointer.
	* src/kwsearch.c (Fcompile):
	* src/pcresearch.c (Pcompile): Ignore the 3rd syntax argument.

	grep: simplify line counting in patterns
	* src/grep.c (n_patterns): Rename from patfile_lineno,
	as it is now origin-zero.  Now size_t, not uintmax_t.
	(count_nl_bytes, fl_add): Simplify to just buffer and size.
	All callers changed.

2016-12-19  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2016-12-18  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

	build: update gnulib submodule to latest

2016-12-13  Jim Meyering  <meyering@fb.com>

	tests: use just-built grep in more places
	* cfg.mk (PATH): Prepend $(srcdir)/src, so that we use the just-
	built grep also when running commands like those of "make distcheck".
	This would have avoided the recently-luckily-noticed infloop bug.
	Tested by running this in a just-built directory:
	f=src/grep; printf '%s\n' '#!/bin/sh' 'sleep 9h' > $f; chmod a+x $f
	and then verifying that nearly every "make syntax-check" rule hangs.

	maint: tell "syntax-check" not to worry about the NEWS update
	Whenever we change "old" NEWS, we have to update this checksum.
	Otherwise, a "make syntax-check" test that guards against a class
	of logical merge conflicts will fail.
	* cfg.mk (old_NEWS_hash): Update this hash to accommodate the
	recent clarification of a 2.27 NEWS entry.

2016-12-13  Arnold D. Robbins  <arnold@skeeve.com>

	build: update gnulib submodule to latest
	* src/dfasearch.c (GEAcompile): Remove use of flag, RE_ICASE covers it.
