SHA256
1
0
forked from pool/grep
OBS User unknown 2007-10-02 22:55:33 +00:00 committed by Git OBS Bridge
parent 47b8536896
commit 67cc99e155
4 changed files with 98 additions and 14 deletions

74
grep-i18n-speedup.diff Normal file
View File

@ -0,0 +1,74 @@
--- src/search.c
+++ src/search.c
@@ -140,7 +140,7 @@ kwsmusts (void)
are not single byte character nor the first byte of a multibyte
character. Caller must free the array. */
static char*
-check_multibyte_string(char const *buf, size_t size)
+check_multibyte_string(char const *buf, size_t size, int case_convert)
{
char *mb_properties = xmalloc(size);
mbstate_t cur_state;
@@ -161,7 +161,7 @@ check_multibyte_string(char const *buf,
We treat it as a single byte character. */
mbclen = 1;
}
- else if (match_icase)
+ else if (case_convert)
{
if (iswupper((wint_t)wc))
{
@@ -327,9 +327,9 @@ EXECUTE_FCT(EGexecute)
if (start_ptr)
start_ptr = case_buf + (start_ptr - buf);
buf = case_buf;
+ if (kwset)
+ mb_properties = check_multibyte_string(buf, size, 1);
}
- if (kwset)
- mb_properties = check_multibyte_string(buf, size);
}
#endif /* MBS_SUPPORT */
@@ -352,8 +352,13 @@ EXECUTE_FCT(EGexecute)
end = memchr(beg, eol, buflim - beg);
end++;
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && mb_properties[beg - buf] == 0)
- continue;
+ if (MB_CUR_MAX > 1)
+ {
+ if (!mb_properties)
+ mb_properties = check_multibyte_string (buf, size, 0);
+ if (mb_properties[beg - buf] == 0)
+ continue;
+ }
#endif
while (beg > buf && beg[-1] != eol)
--beg;
@@ -543,8 +548,8 @@ EXECUTE_FCT(Fexecute)
if (start_ptr)
start_ptr = case_buf + (start_ptr - buf);
buf = case_buf;
+ mb_properties = check_multibyte_string(buf, size, 1);
}
- mb_properties = check_multibyte_string(buf, size);
}
#endif /* MBS_SUPPORT */
@@ -554,8 +559,13 @@ EXECUTE_FCT(Fexecute)
if (offset == (size_t) -1)
goto failure;
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0)
- continue; /* It is a part of multibyte character. */
+ if (MB_CUR_MAX > 1)
+ {
+ if (!mb_properties)
+ mb_properties = check_multibyte_string(buf, size, 0);
+ if (mb_properties[offset+beg-buf] == 0)
+ continue; /* It is a part of multibyte character. */
+ }
#endif /* MBS_SUPPORT */
beg += offset;
len = kwsmatch.size[0];

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Sep 12 14:32:07 CEST 2007 - schwab@suse.de
- Allocate MB properties lazily.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue May 15 15:00:53 CEST 2007 - schwab@suse.de Tue May 15 15:00:53 CEST 2007 - schwab@suse.de

View File

@ -12,14 +12,14 @@
Name: grep Name: grep
BuildRequires: pcre-devel BuildRequires: pcre-devel
URL: http://www.gnu.org/software/grep/ Url: http://www.gnu.org/software/grep/
License: GNU General Public License (GPL) License: GPL v2 or later
Group: Productivity/Text/Utilities Group: Productivity/Text/Utilities
Provides: base:/usr/bin/grep Provides: base:/usr/bin/grep
Autoreqprov: on AutoReqProv: on
PreReq: %{install_info_prereq} PreReq: %{install_info_prereq}
Version: 2.5.2 Version: 2.5.2
Release: 3 Release: 29
Summary: Print lines matching a pattern Summary: Print lines matching a pattern
Source: grep-%{version}.tar.bz2 Source: grep-%{version}.tar.bz2
Patch: grep-%{version}.diff Patch: grep-%{version}.diff
@ -30,6 +30,7 @@ Patch4: wordmatch.patch
Patch5: grep-2.5.1a-mbcset.diff Patch5: grep-2.5.1a-mbcset.diff
Patch6: xfail-tests.diff Patch6: xfail-tests.diff
Patch7: icase.diff Patch7: icase.diff
Patch8: grep-i18n-speedup.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description %description
@ -48,7 +49,7 @@ Authors:
Ulrich Drepper <drepper@cygnus.com> Ulrich Drepper <drepper@cygnus.com>
%prep %prep
%setup %setup -q
%patch %patch
%patch1 %patch1
%patch2 %patch2
@ -57,6 +58,7 @@ Authors:
%patch5 %patch5
%patch6 %patch6
%patch7 %patch7
%patch8
%build %build
%{suse_update_config -f} %{suse_update_config -f}
@ -96,8 +98,9 @@ ln -sf ../../bin/grep $RPM_BUILD_ROOT/usr/bin/grep
%doc %{_mandir}/man1/grep.1.gz %doc %{_mandir}/man1/grep.1.gz
%doc %{_infodir}/grep*.gz %doc %{_infodir}/grep*.gz
/usr/share/locale/*/LC_MESSAGES/grep.mo /usr/share/locale/*/LC_MESSAGES/grep.mo
%changelog %changelog
* Wed Sep 12 2007 - schwab@suse.de
- Allocate MB properties lazily.
* Tue May 15 2007 - schwab@suse.de * Tue May 15 2007 - schwab@suse.de
- Fix some icase bugs. - Fix some icase bugs.
* Mon May 07 2007 - schwab@suse.de * Mon May 07 2007 - schwab@suse.de

View File

@ -1,5 +1,5 @@
--- src/grep.c.~1.121.~ 2006-08-25 17:43:30.000000000 +0200 --- src/grep.c
+++ src/grep.c 2007-05-15 14:13:24.000000000 +0200 +++ src/grep.c
@@ -789,28 +789,10 @@ print_line_middle (const char *beg, cons @@ -789,28 +789,10 @@ print_line_middle (const char *beg, cons
size_t match_offset; size_t match_offset;
const char *cur = beg; const char *cur = beg;
@ -41,9 +41,9 @@
if (only_matching) if (only_matching)
cur = lim; cur = lim;
else if (mid) else if (mid)
--- src/search.c.~1.40.~ 2005-12-12 16:26:59.000000000 +0100 --- src/search.c
+++ src/search.c 2007-05-15 14:49:38.000000000 +0200 +++ src/search.c
@@ -192,11 +192,18 @@ GEAcompile (char const *pattern, size_t @@ -192,11 +192,19 @@ GEAcompile (char const *pattern, size_t
const char *sep; const char *sep;
size_t total = size; size_t total = size;
char const *motif = pattern; char const *motif = pattern;
@ -54,8 +54,9 @@
- syntax_bits |= RE_ICASE; - syntax_bits |= RE_ICASE;
+ if (match_icase + if (match_icase
+#ifdef MBS_SUPPORT +#ifdef MBS_SUPPORT
+ && MB_CUR_MAX == 1) + && MB_CUR_MAX == 1
#endif #endif
+ )
+ { + {
+ int i; + int i;
+ for (i = 0; i < NCHAR; i++) + for (i = 0; i < NCHAR; i++)
@ -65,14 +66,15 @@
re_set_syntax (syntax_bits); re_set_syntax (syntax_bits);
dfasyntax (syntax_bits, match_icase, eolbyte); dfasyntax (syntax_bits, match_icase, eolbyte);
@@ -224,6 +231,11 @@ GEAcompile (char const *pattern, size_t @@ -224,6 +232,12 @@ GEAcompile (char const *pattern, size_t
if (patterns == NULL) if (patterns == NULL)
error (2, errno, _("memory exhausted")); error (2, errno, _("memory exhausted"));
patterns[pcount] = patterns0; patterns[pcount] = patterns0;
+ if (match_icase + if (match_icase
+#ifdef MBS_SUPPORT +#ifdef MBS_SUPPORT
+ && MB_CUR_MAX == 1) + && MB_CUR_MAX == 1
+#endif +#endif
+ )
+ patterns[pcount].regexbuf.translate = translate; + patterns[pcount].regexbuf.translate = translate;
if ((err = re_compile_pattern (motif, len, if ((err = re_compile_pattern (motif, len,