svn commit: r346054 - head/lib/libc/string

Ed Maste emaste at FreeBSD.org
Tue Sep 3 14:07:09 UTC 2019


Author: emaste
Date: Tue Apr  9 15:52:18 2019
New Revision: 346054
URL: https://svnweb.freebsd.org/changeset/base/346054

Log:
  libc: update strstr implementation to match musl
  
  musl commits:
  122d67f846cb0be2c9e1c3880db9eb9545bbe38c
  0239cd0681e889a269fb7691f60e81ef8d081e6b
  8f5a820d147da36bcdbddd201b35d293699dacd8
  
  Submitted by:	David CARLIER <devnexen_gmail.com>
  Obtained from:	musl
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D19834

Modified:
  head/lib/libc/string/strstr.c

Modified: head/lib/libc/string/strstr.c
==============================================================================
--- head/lib/libc/string/strstr.c	Tue Apr  9 15:24:38 2019	(r346053)
+++ head/lib/libc/string/strstr.c	Tue Apr  9 15:52:18 2019	(r346054)
@@ -143,9 +143,8 @@ static char *twoway_strstr(const unsigned char *h, con
 		/* 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;




More information about the svn-src-all mailing list