mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
fix spuriously slow check in twoway strstr/memmem cores
mem0 && mem && ... is redundant since mem can only be nonzero when mem0 is nonzero.
This commit is contained in:
parent
1b52863e24
commit
8f5a820d14
2 changed files with 2 additions and 2 deletions
|
@ -100,7 +100,7 @@ static char *twoway_memmem(const unsigned char *h, const unsigned char *z, const
|
|||
if (BITOP(byteset, h[l-1], &)) {
|
||||
k = l-shift[h[l-1]];
|
||||
if (k) {
|
||||
if (mem0 && mem && k < p) k = l-p;
|
||||
if (mem && k < p) k = l-p;
|
||||
h += k;
|
||||
mem = 0;
|
||||
continue;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue