This patch significantly improves performance of strstr by using Sunday's
Quick-Search algorithm. Due to its simplicity it has the best average
performance of string matching algorithms on almost all inputs. It uses a
bad-character shift table to skip past mismatches.
...
---
diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c
index e72b4bd9125f928486f52bb3ebd199eacef7cfaf..ccbcc50a1b034d36200b9b4b17e8c4f62fcb7fc0 100644
--- a/newlib/libc/string/strstr.c
+++ b/newlib/libc/string/strstr.c
@@ -1,169 +1,154 @@
-/*
-FUNCTION
- <<strstr>>---find string segment
-
-INDEX
- strstr
-
-SYNOPSIS
- #include <string.h>
- char *strstr(const char *<[s1]>, const char *<[s2]>);
-
-DESCRIPTION
- Locates the first occurrence in the string pointed to by <[s1]> of
- the sequence of characters in the string pointed to by <[s2]>
- (excluding the terminating null character).
-
-RETURNS
- Returns a pointer to the located string segment, or a null
- pointer if the string <[s2]> is not found. If <[s2]> points to
- a string with zero length, <[s1]> is returned.
-
-PORTABILITY
-<<strstr>> is ANSI C.
-
-<<strstr>> requires no supporting OS subroutines.
-
-QUICKREF
- strstr ansi pure
-*/