From 553606aabfd8bc526242fd3fbaabe45937a5de5e Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Nov 08 2004 09:14:38 +0000 Subject: - Automatically disable DFA when processing multibyte input. GREP_USE_DFA environment variable overrides. --- diff --git a/grep-2.5.1-dfa-optional.patch b/grep-2.5.1-dfa-optional.patch index 0b9d981..7b33226 100644 --- a/grep-2.5.1-dfa-optional.patch +++ b/grep-2.5.1-dfa-optional.patch @@ -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]))) diff --git a/grep.spec b/grep.spec index 59479b5..5f3f144 100644 --- a/grep.spec +++ b/grep.spec @@ -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 2.5.1-36 +- Automatically disable DFA when processing multibyte input. GREP_USE_DFA + environment variable overrides. + * Fri Nov 5 2004 Tim Waugh 2.5.1-35 - Fixes to egf-speedup patch: now it does not change any functionality, as intended.