This commit is contained in:
Tim Waugh 2004-12-17 15:49:11 +00:00
parent a5ca95c10c
commit e5092c306f
2 changed files with 18 additions and 15 deletions

View File

@ -1,5 +1,5 @@
--- grep-2.5.1/src/search.c 2004-12-16 16:53:01.110921088 +0000 --- grep-2.5.1/src/search.c 2004-12-16 17:46:57.039678304 +0000
+++ grep-2.5.1/src/search.c 2004-12-16 17:46:57.039678304 +0000 +++ grep-2.5.1/src/search.c 2004-12-17 13:03:49.300731757 +0000
@@ -39,6 +39,9 @@ @@ -39,6 +39,9 @@
#ifdef HAVE_LIBPCRE #ifdef HAVE_LIBPCRE
# include <pcre.h> # include <pcre.h>
@ -125,7 +125,7 @@
#endif /* MBS_SUPPORT */ #endif /* MBS_SUPPORT */
buflim = buf + size; buflim = buf + size;
@@ -373,21 +337,60 @@ @@ -373,21 +337,63 @@
if (kwset) if (kwset)
{ {
/* Find a possible match using the KWset matcher. */ /* Find a possible match using the KWset matcher. */
@ -185,12 +185,15 @@
while (beg > buf && beg[-1] != eol) while (beg > buf && beg[-1] != eol)
--beg; --beg;
- if (kwsm.index < kwset_exact_matches) - if (kwsm.index < kwset_exact_matches)
+ if (!(match_icase && MB_CUR_MAX > 1) && + if (
+#ifdef MBS_SUPPORT
+ !(match_icase && MB_CUR_MAX > 1) &&
+#endif /* MBS_SUPPORT */
+ (kwsm.index < kwset_exact_matches)) + (kwsm.index < kwset_exact_matches))
goto success_in_beg_and_end; goto success_in_beg_and_end;
if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1) if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
continue; continue;
@@ -395,13 +398,47 @@ @@ -395,13 +401,47 @@
else else
{ {
/* No good fixed strings; start with DFA. */ /* No good fixed strings; start with DFA. */
@ -238,7 +241,7 @@
while (beg > buf && beg[-1] != eol) while (beg > buf && beg[-1] != eol)
--beg; --beg;
} }
@@ -469,15 +506,6 @@ @@ -469,15 +509,6 @@
} /* for (beg = end ..) */ } /* for (beg = end ..) */
failure: failure:
@ -254,7 +257,7 @@
return (size_t) -1; return (size_t) -1;
success_in_beg_and_end: success_in_beg_and_end:
@@ -486,15 +514,6 @@ @@ -486,15 +517,6 @@
/* FALLTHROUGH */ /* FALLTHROUGH */
success_in_start_and_len: success_in_start_and_len:
@ -270,7 +273,7 @@
*match_size = len; *match_size = len;
return start; return start;
} }
@@ -504,6 +523,7 @@ @@ -504,6 +526,7 @@
{ {
char const *beg, *lim, *err; char const *beg, *lim, *err;
@ -278,7 +281,7 @@
kwsinit (); kwsinit ();
beg = pattern; beg = pattern;
do do
@@ -531,17 +551,8 @@ @@ -531,17 +554,8 @@
struct kwsmatch kwsmatch; struct kwsmatch kwsmatch;
size_t ret_val; size_t ret_val;
#ifdef MBS_SUPPORT #ifdef MBS_SUPPORT
@ -298,7 +301,7 @@
#endif /* MBS_SUPPORT */ #endif /* MBS_SUPPORT */
for (beg = buf; beg <= buf + size; ++beg) for (beg = buf; beg <= buf + size; ++beg)
@@ -550,8 +561,33 @@ @@ -550,8 +564,33 @@
if (offset == (size_t) -1) if (offset == (size_t) -1)
goto failure; goto failure;
#ifdef MBS_SUPPORT #ifdef MBS_SUPPORT
@ -334,7 +337,7 @@
#endif /* MBS_SUPPORT */ #endif /* MBS_SUPPORT */
beg += offset; beg += offset;
len = kwsmatch.size[0]; len = kwsmatch.size[0];
@@ -587,6 +623,36 @@ @@ -587,6 +626,36 @@
if (offset == -1) { if (offset == -1) {
break; /* Try a different anchor. */ break; /* Try a different anchor. */
} }
@ -371,7 +374,7 @@
beg += offset; beg += offset;
len = kwsmatch.size[0]; len = kwsmatch.size[0];
} }
@@ -597,19 +663,31 @@ @@ -597,19 +666,31 @@
} }
failure: failure:
@ -411,7 +414,7 @@
end++; end++;
while (buf < beg && beg[-1] != eol) while (buf < beg && beg[-1] != eol)
--beg; --beg;
@@ -618,15 +696,6 @@ @@ -618,15 +699,6 @@
success_in_beg_and_len: success_in_beg_and_len:
*match_size = len; *match_size = len;

View File

@ -1,7 +1,7 @@
Summary: The GNU versions of grep pattern matching utilities. Summary: The GNU versions of grep pattern matching utilities.
Name: grep Name: grep
Version: 2.5.1 Version: 2.5.1
Release: 42 Release: 43
License: GPL License: GPL
Group: Applications/Text Group: Applications/Text
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2 Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2
@ -85,7 +85,7 @@ fi
%{_mandir}/*/* %{_mandir}/*/*
%changelog %changelog
* Thu Dec 16 2004 Tim Waugh <twaugh@redhat.com> * Thu Dec 16 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-43
- Bypass kwset matching when ignoring case and processing multibyte input - Bypass kwset matching when ignoring case and processing multibyte input
(bug #143079). (bug #143079).