From e0d39a9133e1507345d73ac5aff85f037f39aa54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= Date: Fri, 12 Nov 2021 16:45:04 -0800 Subject: grep: migrate to pcre2 Mostly a bug by bug translation of the original code to the PCRE2 API. Code still could do with some optimizations but should be good as a starting point. The API changes the sign of some types and therefore some ugly casts were needed, some of the changes are just to make sure all variables fit into the newer types better. Includes backward compatibility and could be made to build all the way to 10.00, but assumes a recent enough version and has been tested with 10.23 (from CentOS 7, the oldest). Performance seems equivalent, and it also seems functionally complete. * m4/pcre.m4 (gl_FUNC_PCRE): Check for PCRE2, not the original PCRE. * src/pcresearch.c (struct pcre_comp, jit_exec) (Pcompile, Pexecute): Use PCRE2, not the original PCRE. * tests/filename-lineno.pl: Adjust to match PCRE2 diagnostics. --- doc/grep.in.1 | 8 ++++---- doc/grep.texi | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/grep.in.1 b/doc/grep.in.1 index b014f657..208cb76d 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -756,7 +756,7 @@ In other implementations, basic regular expressions are less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. Perl-compatible regular expressions give additional functionality, and are -documented in B(3) and B(3), but work only if +documented in B(3) and B(3), but work only if PCRE support is enabled. .PP The fundamental building blocks are the regular expressions @@ -1360,9 +1360,9 @@ from the globbing syntax that the shell uses to match file names. .BR sort (1), .BR xargs (1), .BR read (2), -.BR pcre (3), -.BR pcresyntax (3), -.BR pcrepattern (3), +.BR pcre2 (3), +.BR pcre2syntax (3), +.BR pcre2pattern (3), .BR terminfo (5), .BR glob (7), .BR regex (7) diff --git a/doc/grep.texi b/doc/grep.texi index e5b9fd8a..c3c4bbfa 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -1168,7 +1168,7 @@ In other implementations, basic regular expressions are less powerful. The following description applies to extended regular expressions; differences for basic regular expressions are summarized afterwards. Perl-compatible regular expressions give additional functionality, and -are documented in the @i{pcresyntax}(3) and @i{pcrepattern}(3) manual +are documented in the @i{pcre2syntax}(3) and @i{pcre2pattern}(3) manual pages, but work only if PCRE is available in the system. @menu -- cgit v1.2.1