From c53e9b239418eb3e0e8be256abd0f6ad7608bbcf Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 9 Dec 2020 11:34:29 -0500 Subject: 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. --- src/string/strstr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- cgit v1.2.1