From 22ccf855bfb771f59f5aaaae1d26d33679fec931 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 9 Apr 2019 15:52:18 +0000 Subject: libc: update strstr implementation to match musl musl commits: 122d67f846cb0be2c9e1c3880db9eb9545bbe38c 0239cd0681e889a269fb7691f60e81ef8d081e6b 8f5a820d147da36bcdbddd201b35d293699dacd8 Submitted by: David CARLIER Obtained from: musl MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19834 --- lib/libc/string/strstr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libc/string/strstr.c b/lib/libc/string/strstr.c index 890a4aba98f5c..c17ed8208f18c 100644 --- a/lib/libc/string/strstr.c +++ b/lib/libc/string/strstr.c @@ -143,9 +143,8 @@ static char *twoway_strstr(const unsigned char *h, const unsigned char *n) /* Check last byte first; advance by shift on mismatch */ if (BITOP(byteset, h[l-1], &)) { k = l-shift[h[l-1]]; - //printf("adv by %zu (on %c) at [%s] (%zu;l=%zu)\n", k, h[l-1], h, shift[h[l-1]], l); if (k) { - if (mem0 && mem && k < p) k = l-p; + if (k < mem) k = mem; h += k; mem = 0; continue; -- cgit v1.3