All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Joonwoo Park <joonwpark81@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	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 13:33:39 +0200	[thread overview]
Message-ID: <485F8A13.90808@trash.net> (raw)
In-Reply-To: <b25c3fa70806210217w48658acewc2f987414bd312c3@mail.gmail.com>

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.


  reply	other threads:[~2008-06-23 11:33 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 [this message]
2008-06-23 12:27       ` Pablo Neira Ayuso
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=485F8A13.90808@trash.net \
    --to=kaber@trash.net \
    --cc=joonwpark81@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.