bkabrda / rpms / grep

Forked from rpms/grep 6 years ago
Clone

Blame grep-2.6.3-glibc-matcher-fallback.patch

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