about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--ext/http11/http11.c6
1 files changed, 3 insertions, 3 deletions
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;