about summary refs log tree commit diff
path: root/src/string/strstr.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-11-02 12:01:37 -0400
committerRich Felker <dalias@aerifal.cx>2018-11-02 12:02:09 -0400
commit8f5a820d147da36bcdbddd201b35d293699dacd8 (patch)
treed2f96ac9eb116cd29e55102bcabdbc3a5c5a477b /src/string/strstr.c
parent1b52863e244ecee5b5935b6d36bb9e6efe84c035 (diff)
downloadmusl-8f5a820d147da36bcdbddd201b35d293699dacd8.tar.gz
musl-8f5a820d147da36bcdbddd201b35d293699dacd8.tar.xz
musl-8f5a820d147da36bcdbddd201b35d293699dacd8.zip
fix spuriously slow check in twoway strstr/memmem cores
mem0 && mem && ... is redundant since mem can only be nonzero when
mem0 is nonzero.
Diffstat (limited to 'src/string/strstr.c')
-rw-r--r--src/string/strstr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string/strstr.c b/src/string/strstr.c
index cd069127..c80e9caf 100644
--- a/src/string/strstr.c
+++ b/src/string/strstr.c
@@ -110,7 +110,7 @@ static char *twoway_strstr(const unsigned char *h, const unsigned char *n)
 			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 (mem && k < p) k = l-p;
 				h += k;
 				mem = 0;
 				continue;