From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Joonwoo Park <joonwpark81@gmail.com>
Cc: Patrick McHardy <kaber@trash.net>,
netdev <netdev@vger.kernel.org>,
netfilter-devel <netfilter-devel@vger.kernel.org>,
Thomas Graf <tgraf@suug.ch>
Subject: Re: [PATCH 3/8] textsearch: fix Boyer-Moore algorithm for case insensitive searching
Date: Mon, 23 Jun 2008 14:27:18 +0200 [thread overview]
Message-ID: <485F96A6.20904@netfilter.org> (raw)
In-Reply-To: <485F8A13.90808@trash.net>
Patrick McHardy wrote:
> Joonwoo Park wrote:
>> 2008/6/21 Patrick McHardy <kaber@trash.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
next prev parent reply other threads:[~2008-06-23 12:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-21 7:54 [PATCH 3/8] textsearch: fix Boyer-Moore algorithm for case insensitive searching Joonwoo Park
2008-06-21 8:25 ` Patrick McHardy
2008-06-21 9:17 ` Joonwoo Park
2008-06-23 11:33 ` Patrick McHardy
2008-06-23 12:27 ` Pablo Neira Ayuso [this message]
2008-06-23 20:41 ` Joonwoo Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=485F96A6.20904@netfilter.org \
--to=pablo@netfilter.org \
--cc=joonwpark81@gmail.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).