i = j = 0;
while (i+n <= len) {
- if (s[i] == sub[0] && (n == 1 || memcmp(s+i, sub, n) == 0)) {
+ if (s[i] == sub[0] && memcmp(s+i, sub, n) == 0) {
if (maxsplit-- <= 0)
break;
item = PyString_FromStringAndSize(s+j, (int)(i-j));
return (long)i;
last -= n;
for (; i <= last; ++i)
- if (s[i] == sub[0] &&
- (n == 1 || memcmp(&s[i+1], &sub[1], n-1) == 0))
+ if (s[i] == sub[0] && memcmp(&s[i], sub, n) == 0)
return (long)i;
}
else {
if (n == 0 && i <= last)
return (long)last;
for (j = last-n; j >= i; --j)
- if (s[j] == sub[0] &&
- (n == 1 || memcmp(&s[j+1], &sub[1], n-1) == 0))
+ if (s[j] == sub[0] && memcmp(&s[j], sub, n) == 0)
return (long)j;
}
len -= pat_len;
for (ii = 0; ii <= len; ii++) {
- if (mem[ii] == pat[0] &&
- (pat_len == 1 ||
- memcmp(&mem[ii+1], &pat[1], pat_len-1) == 0)) {
+ if (mem[ii] == pat[0] && memcmp(&mem[ii], pat, pat_len) == 0) {
return ii;
}
}