[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <485F96A6.20904@netfilter.org>
Date: Mon, 23 Jun 2008 14:27:18 +0200
From: Pablo Neira Ayuso <pablo@...filter.org>
To: Joonwoo Park <joonwpark81@...il.com>
CC: Patrick McHardy <kaber@...sh.net>, netdev <netdev@...r.kernel.org>,
netfilter-devel <netfilter-devel@...r.kernel.org>,
Thomas Graf <tgraf@...g.ch>
Subject: Re: [PATCH 3/8] textsearch: fix Boyer-Moore algorithm for case insensitive
searching
Patrick McHardy wrote:
> Joonwoo Park wrote:
>> 2008/6/21 Patrick McHardy <kaber@...sh.net>:
>>>> +static void compute_prefix_tbl(struct ts_bm *bm, u8 icase)
>>>> {
>>>> int i, j, g;
>>>> for (i = 0; i < ASIZE; i++)
>>>> bm->bad_shift[i] = bm->patlen;
>>>> - for (i = 0; i < bm->patlen - 1; i++)
>>>> + for (i = 0; i < bm->patlen - 1; i++) {
>>>> bm->bad_shift[bm->pattern[i]] = bm->patlen - 1 - i;
>>>> + if (icase)
>>>> + bm->bad_shift[tolower(bm->pattern[i])]
>>>> + = bm->patlen - 1 - i;
>>>> + }
>>> You use toupper() above and tolower() here, is that correct?
>>>
>>
>> It should be, bm->pattern's characters are all upper case since It was
>> altered before.
>> So we should use toupper() for target string character to compare.
>> And to ignore case, we should prepare one more bad_shift array
>> calculation, opposite tolower() should be used for it.
>
> OK thanks. I'll wait for an ACK from Thomas before applying
> them though.
This is rather confusing. Why not set both the pattern and the bad_shift
to lower or upper case?
--
"Los honestos son inadaptados sociales" -- Les Luthiers
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists