- Automatically disable DFA when processing multibyte input. GREP_USE_DFA

environment variable overrides.
This commit is contained in:
Tim Waugh 2004-11-08 09:14:38 +00:00
parent d619d25368
commit 553606aabf
2 changed files with 26 additions and 8 deletions

View File

@ -1,6 +1,6 @@
--- grep-2.5.1/src/search.c.dfa-optional 2004-11-05 16:16:45.230641568 +0000
+++ grep-2.5.1/src/search.c 2004-11-05 16:36:19.679817421 +0000
@@ -305,11 +305,19 @@
--- grep-2.5.1/src/search.c.dfa-optional 2004-11-07 20:04:26.181494244 +0000
+++ grep-2.5.1/src/search.c 2004-11-07 20:11:07.437866925 +0000
@@ -305,11 +305,33 @@
int backref, start, len;
struct kwsmatch kwsm;
size_t i, ret_val;
@ -13,14 +13,28 @@
+ if (!use_dfa_checked)
+ {
+ use_dfa = (getenv ("GREP_NO_DFA") == NULL);
+ char *grep_use_dfa = getenv ("GREP_USE_DFA");
+ if (!grep_use_dfa)
+ {
+#ifdef MBS_SUPPORT
+ /* Turn off DFA when processing multibyte input. */
+ use_dfa = (MB_CUR_MAX == 1);
+#else
+ use_dfa = 1;
+#endif /* MBS_SUPPORT */
+ }
+ else
+ {
+ use_dfa = atoi (grep_use_dfa);
+ }
+
+ use_dfa_checked = 1;
+ }
+
buflim = buf + size;
for (beg = end = buf; end < buflim; beg = end)
@@ -365,7 +373,8 @@
@@ -365,7 +387,8 @@
--beg;
if (kwsm.index < kwset_exact_matches)
goto success_in_beg_and_end;
@ -30,7 +44,7 @@
continue;
}
else
@@ -374,7 +383,9 @@
@@ -374,7 +397,9 @@
#ifdef MBS_SUPPORT
size_t bytes_left = 0;
#endif /* MBS_SUPPORT */
@ -41,7 +55,7 @@
if (offset == (size_t) -1)
break;
/* Narrow down to the line we've found. */
@@ -450,7 +461,11 @@
@@ -450,7 +475,11 @@
if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1]))
&& (len == end - beg - 1
|| !WCHAR ((unsigned char) beg[start + len])))

View File

@ -1,7 +1,7 @@
Summary: The GNU versions of grep pattern matching utilities.
Name: grep
Version: 2.5.1
Release: 35
Release: 36
License: GPL
Group: Applications/Text
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2
@ -83,6 +83,10 @@ fi
%{_mandir}/*/*
%changelog
* Mon Nov 8 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-36
- Automatically disable DFA when processing multibyte input. GREP_USE_DFA
environment variable overrides.
* Fri Nov 5 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-35
- Fixes to egf-speedup patch: now it does not change any functionality,
as intended.