Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Apr 2019 15:52:18 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r346054 - head/lib/libc/string
Message-ID:  <201904091552.x39FqImw038925@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904091552.x39FqImw038925>