From 86aac04128133728a2fddf5627ac840fe520b71f Mon Sep 17 00:00:00 2001 From: zedshaw Date: Sat, 25 Nov 2006 01:25:04 +0000 Subject: A few tweaks to bmhsearch prior to the branch out. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@408 19e92222-5c0b-0410-8929-a290d50e31e9 --- ext/http11/http11.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/http11') diff --git a/ext/http11/http11.c b/ext/http11/http11.c index ef51ebb..0d2c79a 100644 --- a/ext/http11/http11.c +++ b/ext/http11/http11.c @@ -299,9 +299,6 @@ VALUE BMHSearch_find(VALUE self, VALUE hay) rb_raise(eBMHSearchError, "Corrupt search state. REALLY BAD!"); } - /* Start searching from the end of S->needle (this is not a typo) */ - hpos = S->nlen-1; - /* Check for a trailing remainder, which is only possible if skip > 1 */ if(S->skip) { // only scan for what should be the rest of the string @@ -315,6 +312,9 @@ VALUE BMHSearch_find(VALUE self, VALUE hay) } + /* Start searching from the end of S->needle (this is not a typo) */ + hpos = S->nlen-1; + while(hpos < hlen) { /* Compare the S->needle backwards, and stop when first mismatch is found */ npos = S->nlen-1; -- cgit v1.2.3-24-ge0c7