musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/string/strstr.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2020年12月09日 11:34:29 -0500
committerRich Felker <dalias@aerifal.cx>2020年12月09日 11:34:29 -0500
commitc53e9b239418eb3e0e8be256abd0f6ad7608bbcf (patch)
treee404c8fcf9636fe6ef41eb578a01653bbb3b36ae /src/string/strstr.c
parentb67d56c7b3b0f84360db749aa6f431a07761d9c8 (diff)
downloadmusl-c53e9b239418eb3e0e8be256abd0f6ad7608bbcf.tar.gz
fix misleading comment in strstr
the intent here is just to scan at least l bytes forward for the end of the haystack and at least some decent minimum to avoid doing it over and over if the needle is short, with no need to be precise. the comment erroneously stated this as an estimate for MIN when it's actually an estimate for MAX.
Diffstat (limited to 'src/string/strstr.c')
-rw-r--r--src/string/strstr.c 2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string/strstr.c b/src/string/strstr.c
index 43a0207a..96657bc2 100644
--- a/src/string/strstr.c
+++ b/src/string/strstr.c
@@ -96,7 +96,7 @@ static char *twoway_strstr(const unsigned char *h, const unsigned char *n)
for (;;) {
/* Update incremental end-of-haystack pointer */
if (z-h < l) {
- /* Fast estimate for MIN(l,63) */
+ /* Fast estimate for MAX(l,63) */
size_t grow = l | 63;
const unsigned char *z2 = memchr(z, 0, grow);
if (z2) {
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月11日 00:47:20 +0000

AltStyle によって変換されたページ (->オリジナル) /