grep/grep-2.6.3-glibc-matcher-fallback.patch
Jaroslav Škarvada 6ccb1073e9 - Added dfa-optimize-period patch (speedup for . patterns in UTF-8)
- Added glibc-matcher-fallback patch (speedup for [a-z] patterns in UTF-8)
- Added mmap-option-fix patch
- Added dfa-convert-to-wide-char patch (speedup for -m and remove quadratic
    complexity when going to glibc)
- Added dfa-speedup-digit-xdigit patch (speedup for [[:digit:]]
    [:xdigit:]])
2010-05-07 11:34:53 +00:00

39 lines
1.1 KiB
Diff

From 3fca11d78cfa1fec6199936d57871b9db08226ab Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <bonzini@gnu.org>
Date: Thu, 29 Apr 2010 17:13:32 +0200
Subject: [PATCH 2/2] fall back to glibc matcher if a MBCSET is found
This patch works around the performance problems of multibyte grep
upstream.
For UTF-8 it should trigger only in the presence of MBCSET, e.g. [a-z].
For other character sets all brackets and `.` as well will trigger it.
---
src/dfa.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index e13c361..523fe05 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -2927,6 +2927,15 @@ dfaexec (struct dfa *d, char const *begin, char *end,
continue;
}
+ if (backref)
+ {
+ *backref = 1;
+ free(mblen_buf);
+ free(inputwcs);
+ *end = saved_end;
+ return (char *) p;
+ }
+
/* Can match with a multibyte character (and multi character
collating element). Transition table might be updated. */
s = transit_state(d, s, &p);
--
1.6.6.1