svn commit: r346268 - stable/12/lib/libc/string

Ed Maste emaste at FreeBSD.org
Tue Sep 3 14:06:57 UTC 2019


Author: emaste
Date: Tue Apr 16 11:30:41 2019
New Revision: 346268
URL: https://svnweb.freebsd.org/changeset/base/346268

Log:
  MFC r346054: 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

Modified:
  stable/12/lib/libc/string/strstr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/string/strstr.c
==============================================================================
--- stable/12/lib/libc/string/strstr.c	Tue Apr 16 11:20:10 2019	(r346267)
+++ stable/12/lib/libc/string/strstr.c	Tue Apr 16 11:30:41 2019	(r346268)
@@ -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-stable-12 mailing list