OBS User unknown 2007-05-17 09:38:38 +00:00 committed by Git OBS Bridge
parent 9c56d9d307
commit 47b8536896
3 changed files with 89 additions and 1 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue May 15 15:00:53 CEST 2007 - schwab@suse.de
- Fix some icase bugs.
-------------------------------------------------------------------
Mon May 7 15:41:23 CEST 2007 - schwab@suse.de

View File

@ -19,7 +19,7 @@ Provides: base:/usr/bin/grep
Autoreqprov: on
PreReq: %{install_info_prereq}
Version: 2.5.2
Release: 1
Release: 3
Summary: Print lines matching a pattern
Source: grep-%{version}.tar.bz2
Patch: grep-%{version}.diff
@ -29,6 +29,7 @@ Patch3: grep-2.5.2-nb.patch
Patch4: wordmatch.patch
Patch5: grep-2.5.1a-mbcset.diff
Patch6: xfail-tests.diff
Patch7: icase.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -55,6 +56,7 @@ Authors:
%patch4
%patch5
%patch6
%patch7
%build
%{suse_update_config -f}
@ -96,6 +98,8 @@ ln -sf ../../bin/grep $RPM_BUILD_ROOT/usr/bin/grep
/usr/share/locale/*/LC_MESSAGES/grep.mo
%changelog
* Tue May 15 2007 - schwab@suse.de
- Fix some icase bugs.
* Mon May 07 2007 - schwab@suse.de
- Try to get something sensible out of CVS.
* Thu Mar 22 2007 - schwab@suse.de

79
icase.diff Normal file
View File

@ -0,0 +1,79 @@
--- src/grep.c.~1.121.~ 2006-08-25 17:43:30.000000000 +0200
+++ src/grep.c 2007-05-15 14:13:24.000000000 +0200
@@ -789,28 +789,10 @@ print_line_middle (const char *beg, cons
size_t match_offset;
const char *cur = beg;
const char *mid = NULL;
- char *buf; /* XXX */
- const char *ibeg; /* XXX */
-
- if (match_icase) /* XXX - None of the -i stuff should be here. */
- {
- int i = lim - beg;
-
- ibeg = buf = (char *) xmalloc(i);
- /* This can't possibly be correct with UTF-8,
- but it's equivalent to what was there so far. */
- while (--i >= 0)
- buf[i] = tolower(beg[i]);
- }
- else
- {
- buf = NULL;
- ibeg = beg;
- }
while ( lim > cur
- && ((match_offset = execute(ibeg, lim - beg, &match_size,
- ibeg + (cur - beg))) != (size_t) -1))
+ && ((match_offset = execute(beg, lim - beg, &match_size,
+ beg + (cur - beg))) != (size_t) -1))
{
char const *b = beg + match_offset;
@@ -854,9 +836,6 @@ print_line_middle (const char *beg, cons
cur = b + match_size;
}
- if (buf)
- free(buf); /* XXX */
-
if (only_matching)
cur = lim;
else if (mid)
--- src/search.c.~1.40.~ 2005-12-12 16:26:59.000000000 +0100
+++ src/search.c 2007-05-15 14:49:38.000000000 +0200
@@ -192,11 +192,18 @@ GEAcompile (char const *pattern, size_t
const char *sep;
size_t total = size;
char const *motif = pattern;
+ static char translate[NCHAR];
-#if 0
- if (match_icase)
- syntax_bits |= RE_ICASE;
+ if (match_icase
+#ifdef MBS_SUPPORT
+ && MB_CUR_MAX == 1)
#endif
+ {
+ int i;
+ for (i = 0; i < NCHAR; i++)
+ translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
+ }
+
re_set_syntax (syntax_bits);
dfasyntax (syntax_bits, match_icase, eolbyte);
@@ -224,6 +231,11 @@ GEAcompile (char const *pattern, size_t
if (patterns == NULL)
error (2, errno, _("memory exhausted"));
patterns[pcount] = patterns0;
+ if (match_icase
+#ifdef MBS_SUPPORT
+ && MB_CUR_MAX == 1)
+#endif
+ patterns[pcount].regexbuf.translate = translate;
if ((err = re_compile_pattern (motif, len,
&(patterns[pcount].regexbuf))) != 0)