- if (Haystack == last_haystack)
- /* No match. */
- return NULL;
-
- /* See whether it's advisable to use an asymptotically faster
- algorithm. */
- if (try_kmp
- && outer_loop_count >= 10
- && comparison_count >= 5 * outer_loop_count)
- {
- /* See if needle + comparison_count now reaches the end of
- needle. */
- if (comparison_count >= needle_len)
- {
- /* Try the Knuth-Morris-Pratt algorithm. */
- const char *result;
- if (knuth_morris_pratt (Haystack, last_haystack,
- Needle - 1, needle_len, &result))
- return (void *) result;
- try_kmp = false;
- }
- }
-
- outer_loop_count++;
- comparison_count++;
- if (*Haystack == b)
- /* The first byte matches. */
- {
- const char *rhaystack = Haystack + 1;
- const char *rneedle = Needle;
-
- for (;; rhaystack++, rneedle++)
- {
- if (rneedle == last_needle)
- /* Found a match. */
- return (void *) Haystack;
- if (rhaystack == last_haystack)
- /* No match. */
- return NULL;
- comparison_count++;
- if (*rhaystack != *rneedle)
- /* Nothing in this round. */
- break;
- }
- }
+ if (haystack == last_haystack)
+ /* No match. */
+ return NULL;
+
+ /* See whether it's advisable to use an asymptotically faster
+ algorithm. */
+ if (try_kmp
+ && outer_loop_count >= 10
+ && comparison_count >= 5 * outer_loop_count)
+ {
+ /* See if needle + comparison_count now reaches the end of
+ needle. */
+ if (comparison_count >= needle_len)
+ {
+ /* Try the Knuth-Morris-Pratt algorithm. */
+ const char *result;
+ if (knuth_morris_pratt (haystack, last_haystack,
+ needle - 1, needle_len, &result))
+ return (void *) result;
+ try_kmp = false;
+ }
+ }
+
+ outer_loop_count++;
+ comparison_count++;
+ if (*haystack == b)
+ /* The first byte matches. */
+ {
+ const char *rhaystack = haystack + 1;
+ const char *rneedle = needle;
+
+ for (;; rhaystack++, rneedle++)
+ {
+ if (rneedle == last_needle)
+ /* Found a match. */
+ return (void *) haystack;
+ if (rhaystack == last_haystack)
+ /* No match. */
+ return NULL;
+ comparison_count++;
+ if (*rhaystack != *rneedle)
+ /* Nothing in this round. */
+ break;
+ }
+ }