From d619d2536890e97e3e2f7d98261eddfa66c61c37 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Nov 05 2004 18:09:53 +0000 Subject: - Fixes to egf-speedup patch: now it does not change any functionality, as intended. - GREP_NO_DFA now turns off the DFA engine, for performance testing. --- diff --git a/grep-2.5.1-dfa-optional.patch b/grep-2.5.1-dfa-optional.patch new file mode 100644 index 0000000..0b9d981 --- /dev/null +++ b/grep-2.5.1-dfa-optional.patch @@ -0,0 +1,56 @@ +--- 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 @@ + int backref, start, len; + struct kwsmatch kwsm; + size_t i, ret_val; ++ static int use_dfa; ++ static int use_dfa_checked = 0; + #ifdef MBS_SUPPORT + mbstate_t mbs; + memset (&mbs, '\0', sizeof (mbstate_t)); + #endif /* MBS_SUPPORT */ + ++ if (!use_dfa_checked) ++ { ++ use_dfa = (getenv ("GREP_NO_DFA") == NULL); ++ use_dfa_checked = 1; ++ } ++ + buflim = buf + size; + + for (beg = end = buf; end < buflim; beg = end) +@@ -365,7 +373,8 @@ + --beg; + if (kwsm.index < kwset_exact_matches) + goto success_in_beg_and_end; +- if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1) ++ if (use_dfa && ++ dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1) + continue; + } + else +@@ -374,7 +383,9 @@ + #ifdef MBS_SUPPORT + size_t bytes_left = 0; + #endif /* MBS_SUPPORT */ +- size_t offset = dfaexec (&dfa, beg, buflim - beg, &backref); ++ size_t offset = 0; ++ if (use_dfa) ++ offset = dfaexec (&dfa, beg, buflim - beg, &backref); + if (offset == (size_t) -1) + break; + /* Narrow down to the line we've found. */ +@@ -450,7 +461,11 @@ + if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1])) + && (len == end - beg - 1 + || !WCHAR ((unsigned char) beg[start + len]))) +- goto success_in_start_and_len; ++ { ++ if (len == 0) ++ len++; ++ goto success_in_start_and_len; ++ } + if (len > 0) + { + /* Try a shorter length anchored at the same place. */ diff --git a/grep.spec b/grep.spec index a4474b7..59479b5 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: 34 +Release: 35 License: GPL Group: Applications/Text Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2 @@ -11,6 +11,7 @@ Patch2: grep-2.5-i18n.patch Patch3: grep-2.5.1-oi.patch Patch4: grep-2.5.1-manpage.patch Patch5: grep-2.5.1-egf-speedup.patch +Patch6: grep-2.5.1-dfa-optional.patch URL: http://www.gnu.org/software/grep/ Prereq: /sbin/install-info Buildroot: %{_tmppath}/%{name}-%{version}-root @@ -34,6 +35,7 @@ utility for searching through text. %patch3 -p1 -b .oi %patch4 -p1 -b .manpage %patch5 -p1 -b .egf-speedup +%patch6 -p1 -b .dfa-optional %build [ ! -e configure ] && ./autogen.sh @@ -81,6 +83,11 @@ fi %{_mandir}/*/* %changelog +* Fri Nov 5 2004 Tim Waugh 2.5.1-35 +- Fixes to egf-speedup patch: now it does not change any functionality, + as intended. +- GREP_NO_DFA now turns off the DFA engine, for performance testing. + * Thu Nov 4 2004 Tim Waugh 2.5.1-34 - More improvements to egf-speedup patch (bug #138076).