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