This commit is contained in:
parent
5b8d935d00
commit
fc2d1d0edd
@ -416,7 +416,7 @@
|
||||
|
||||
#define NCHAR (UCHAR_MAX + 1)
|
||||
|
||||
@@ -140,40 +141,62 @@ kwsmusts (void)
|
||||
@@ -140,40 +141,60 @@ kwsmusts (void)
|
||||
are not single byte character nor the first byte of a multibyte
|
||||
character. Caller must free the array. */
|
||||
static char*
|
||||
@ -447,18 +447,22 @@
|
||||
+ wc = buf[i];
|
||||
+ if (case_convert && iswupper ((wint_t)wc))
|
||||
+ wc = towlower ((wint_t) wc);
|
||||
+ }
|
||||
}
|
||||
- else if (match_icase)
|
||||
+ else
|
||||
+ {
|
||||
{
|
||||
- if (iswupper((wint_t)wc))
|
||||
+ in_shift = true;
|
||||
+ mbclen = mbrtowc(&wc, buf + i, size - i, &cur_state);
|
||||
+
|
||||
+ if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0)
|
||||
+ {
|
||||
{
|
||||
- wc = towlower((wint_t)wc);
|
||||
- wcrtomb(buf + i, wc, &cur_state);
|
||||
+ /* An invalid sequence, or a truncated multibyte character.
|
||||
+ We treat it as a single byte character. */
|
||||
+ mbclen = 1;
|
||||
+ }
|
||||
}
|
||||
+ else if (case_convert)
|
||||
+ {
|
||||
+ if (iswupper((wint_t)wc))
|
||||
@ -469,21 +473,15 @@
|
||||
+ }
|
||||
+ if (mbsinit (&cur_state))
|
||||
+ in_shift = false;
|
||||
}
|
||||
- else if (match_icase)
|
||||
+ if (mbclen != 1)
|
||||
{
|
||||
- if (iswupper((wint_t)wc))
|
||||
+ if (!mb_properties)
|
||||
{
|
||||
- wc = towlower((wint_t)wc);
|
||||
- wcrtomb(buf + i, wc, &cur_state);
|
||||
+ mb_properties = xcalloc (1, size);
|
||||
+ memset (mb_properties, 1, i);
|
||||
}
|
||||
+ mb_properties[i] = mbclen;
|
||||
+ }
|
||||
+ if (mbclen != 1 && !mb_properties)
|
||||
+ {
|
||||
+ mb_properties = xcalloc (1, size);
|
||||
+ memset (mb_properties, 1, i);
|
||||
}
|
||||
- mb_properties[i] = mbclen;
|
||||
+ if (mb_properties)
|
||||
+ mb_properties[i] = mbclen;
|
||||
i += mbclen;
|
||||
}
|
||||
|
||||
@ -492,7 +490,7 @@
|
||||
}
|
||||
#endif /* MBS_SUPPORT */
|
||||
|
||||
@@ -311,9 +334,8 @@ EXECUTE_FCT(EGexecute)
|
||||
@@ -311,9 +332,8 @@ EXECUTE_FCT(EGexecute)
|
||||
if (start_ptr)
|
||||
start_ptr = case_buf + (start_ptr - buf);
|
||||
buf = case_buf;
|
||||
@ -503,7 +501,7 @@
|
||||
}
|
||||
#endif /* MBS_SUPPORT */
|
||||
|
||||
@@ -336,8 +358,14 @@ EXECUTE_FCT(EGexecute)
|
||||
@@ -336,8 +356,14 @@ EXECUTE_FCT(EGexecute)
|
||||
end = memchr(beg, eol, buflim - beg);
|
||||
end++;
|
||||
#ifdef MBS_SUPPORT
|
||||
@ -520,7 +518,7 @@
|
||||
#endif
|
||||
while (beg > buf && beg[-1] != eol)
|
||||
--beg;
|
||||
@@ -478,7 +506,7 @@ EXECUTE_FCT(EGexecute)
|
||||
@@ -478,7 +504,7 @@ EXECUTE_FCT(EGexecute)
|
||||
{
|
||||
if (match_icase)
|
||||
free((char*)buf);
|
||||
@ -529,7 +527,7 @@
|
||||
free(mb_properties);
|
||||
}
|
||||
#endif /* MBS_SUPPORT */
|
||||
@@ -527,8 +555,8 @@ EXECUTE_FCT(Fexecute)
|
||||
@@ -527,8 +553,8 @@ EXECUTE_FCT(Fexecute)
|
||||
if (start_ptr)
|
||||
start_ptr = case_buf + (start_ptr - buf);
|
||||
buf = case_buf;
|
||||
@ -539,7 +537,7 @@
|
||||
}
|
||||
#endif /* MBS_SUPPORT */
|
||||
|
||||
@@ -538,8 +566,14 @@ EXECUTE_FCT(Fexecute)
|
||||
@@ -538,8 +564,14 @@ EXECUTE_FCT(Fexecute)
|
||||
if (offset == (size_t) -1)
|
||||
goto failure;
|
||||
#ifdef MBS_SUPPORT
|
||||
@ -556,7 +554,7 @@
|
||||
#endif /* MBS_SUPPORT */
|
||||
beg += offset;
|
||||
len = kwsmatch.size[0];
|
||||
@@ -595,7 +629,7 @@ EXECUTE_FCT(Fexecute)
|
||||
@@ -595,7 +627,7 @@ EXECUTE_FCT(Fexecute)
|
||||
{
|
||||
if (match_icase)
|
||||
free((char*)buf);
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 3 11:29:37 CEST 2008 - schwab@suse.de
|
||||
|
||||
- Fix last change.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 27 18:45:20 CEST 2008 - schwab@suse.de
|
||||
|
||||
|
@ -20,7 +20,7 @@ Provides: base:/usr/bin/grep
|
||||
AutoReqProv: on
|
||||
PreReq: %{install_info_prereq}
|
||||
Version: 2.5.2
|
||||
Release: 69
|
||||
Release: 72
|
||||
Summary: Print lines matching a pattern
|
||||
Source: grep-%{version}.tar.bz2
|
||||
Patch: grep-%{version}.diff
|
||||
@ -95,6 +95,8 @@ ln -sf ../../bin/grep $RPM_BUILD_ROOT/usr/bin/grep
|
||||
%doc %{_infodir}/*.gz
|
||||
|
||||
%changelog
|
||||
* Tue Jun 03 2008 schwab@suse.de
|
||||
- Fix last change.
|
||||
* Tue May 27 2008 schwab@suse.de
|
||||
- Some speadups.
|
||||
* Mon Feb 11 2008 schwab@suse.de
|
||||
|
Loading…
Reference in New Issue
Block a user