netdev.vger.kernel.org archive mirror
 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>
Subject: Re: [PATCH 3/8] textsearch: fix Boyer-Moore algorithm for case insensitive searching
Date: Sat, 21 Jun 2008 10:25:08 +0200	[thread overview]
Message-ID: <485CBAE4.4030307@trash.net> (raw)
In-Reply-To: <1214034845-1316-1-git-send-email-joonwpark81@gmail.com>

Joonwoo Park wrote:
> @@ -75,7 +77,9 @@ static unsigned int bm_find(struct ts_config *conf, struct ts_state *state)
>  			DEBUGP("Searching in position %d (%c)\n", 
>  				shift, text[shift]);
>  			for (i = 0; i < bm->patlen; i++) 
> -			     if (text[shift-i] != bm->pattern[bm->patlen-1-i])
> +				if ((icase ? toupper(text[shift-i])
> +				    : text[shift-i])
> +					!= bm->pattern[bm->patlen-1-i])
>  				     goto next;
>  
>  			/* London calling... */
> @@ -111,14 +115,18 @@ static int subpattern(u8 *pattern, int i, int j, int g)
>  	return ret;
>  }
>  
> -static void compute_prefix_tbl(struct ts_bm *bm)
> +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?

  reply	other threads:[~2008-06-21  8:25 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 [this message]
2008-06-21  9:17   ` Joonwoo Park
2008-06-23 11:33     ` Patrick McHardy
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=485CBAE4.4030307@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 \
    /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).