Re: [PATCH v2 5/5] Use kwset in grep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 22, 2011 at 08:39, Paolo Bonzini <bonzini@xxxxxxx> wrote:
> On 08/21/2011 12:42 AM, Fredrik Kuivinen wrote:
>>
>> +               if (opt->regflags&  REG_ICASE || p->ignore_case) {
>> +                       static char trans[256];
>> +                       int i;
>> +                       for (i = 0; i<  256; i++)
>> +                               trans[i] = tolower(i);
>> +                       p->kws = kwsalloc(trans);
>> +               } else {
>> +                       p->kws = kwsalloc(NULL);
>> +               }
>
> Of course, this makes absolutely no sense for MB_CUR_MAX > 1.  It's worth
> mentioning that grep instead uses a loop with mbrtowc/towlower/wcrtomb.
>  This in turn will remove the need for the complex kwset code. :)

Good catch. At least it is not a regression from the current behavior,
neither our own strcasestr in compat/ nor strcasestr in glibc can
handle MB_CUR_MAX > 1. My original idea was to make use of kwset also
for the case when more than one fixed string is given to git-grep, but
I didn't find a nice way to refactor the code to make that possible.

> The "mbtolower" code" dates to after the license change, but I wrote it and
> I give permission to use it under GPLv2.  See commits 70e23616 and 30af8050
> in the GNU grep repository.
>
> Should still be good enough for most uses, so I'll give my
>
> Acked-by: Paolo Bonzini <bonzini@xxxxxxx>

Thanks.

- Fredrik
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]