[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A question about bash change for efficiency speedups in multibyte lo
Re: A question about bash change for efficiency speedups in multibyte locales
Wed, 4 Apr 2018 09:23:26 +0800
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
I don't think it should check for '[:', but it should check if the
pattern is defined in the charclass even if the pattern does not have a
when the pattern is one of the character classes defined in the POSIX
standard such as xdigit, these two lines of code can indeed speed up
But I guess it ignored the fact that pattern does not have a multibyte
character but is defined in the charclass in multibyte locales.
Because when there is no these two lines of code in version 4.1 of bash,
the return value of the internal_wstrmatch (wpattern, wstring, flags)
function is correct.
This is because wctype() used in is_wcclass() called by
internal_wstrmatch() can recognize the charclass defined in locale.
However, when these two lines of code are added, the return value of the
internal_strmatch() function in this case is incorrect.
Because internal_strmatch() calls is_class(), and is_class() only
considers the fact that character classes defined in the POSIX standard.
在 2018年04月03日 23:28, Chet Ramey 写道:
> On 4/2/18 10:59 PM, yangyajing wrote:
>> Thanks for your reply.
>> The two lines of code are as follows which in the xstrmatch() function in
>> if (mbsmbchar (string) == 0 && mbsmbchar (pattern) == 0)
>> return (internal_strmatch ((unsigned char *)pattern, (unsigned char
>> *)string, flags));
> Interesting. Do you think it should check for `[:' and not take the
> single-byte character path if that's present?