mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #4107 from oni-link/remove.strlen
search.c: searchit(): Remove strlen() check
This commit is contained in:
commit
130611fca3
@ -621,43 +621,39 @@ int searchit(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
matchcol = endpos.col;
|
matchcol = endpos.col;
|
||||||
/* for empty match: advance one char */
|
// for empty match (matchcol == matchpos.col): advance one char
|
||||||
if (matchcol == matchpos.col
|
|
||||||
&& ptr[matchcol] != NUL) {
|
|
||||||
if (has_mbyte)
|
|
||||||
matchcol +=
|
|
||||||
(*mb_ptr2len)(ptr + matchcol);
|
|
||||||
else
|
|
||||||
++matchcol;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
// Prepare to start after first matched character.
|
||||||
matchcol = matchpos.col;
|
matchcol = matchpos.col;
|
||||||
if (ptr[matchcol] != NUL) {
|
|
||||||
if (has_mbyte)
|
|
||||||
matchcol += (*mb_ptr2len)(ptr
|
|
||||||
+ matchcol);
|
|
||||||
else
|
|
||||||
++matchcol;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (matchcol == 0 && (options & SEARCH_START))
|
|
||||||
|
if (matchcol == matchpos.col && ptr[matchcol] != NUL) {
|
||||||
|
matchcol += MB_PTR2LEN(ptr + matchcol);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matchcol == 0 && (options & SEARCH_START)) {
|
||||||
break;
|
break;
|
||||||
if (STRLEN(ptr) <= (size_t)matchcol || ptr[matchcol] == NUL
|
}
|
||||||
|| (nmatched = vim_regexec_multi(®match,
|
|
||||||
win, buf, lnum + matchpos.lnum,
|
if (ptr[matchcol] == NUL ||
|
||||||
matchcol,
|
(nmatched = vim_regexec_multi(®match, win, buf, lnum,
|
||||||
tm
|
matchcol, tm)) == 0) {
|
||||||
)) == 0) {
|
match_ok = false;
|
||||||
match_ok = FALSE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
matchpos = regmatch.startpos[0];
|
matchpos = regmatch.startpos[0];
|
||||||
endpos = regmatch.endpos[0];
|
endpos = regmatch.endpos[0];
|
||||||
submatch = first_submatch(®match);
|
submatch = first_submatch(®match);
|
||||||
|
|
||||||
/* Need to get the line pointer again, a
|
// This while-loop only works with matchpos.lnum == 0.
|
||||||
* multi-line search may have made it invalid. */
|
// For bigger values the next line pointer ptr might not be a
|
||||||
ptr = ml_get_buf(buf, lnum + matchpos.lnum, FALSE);
|
// buffer line.
|
||||||
|
if (matchpos.lnum != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Need to get the line pointer again, a multi-line search may
|
||||||
|
// have made it invalid.
|
||||||
|
ptr = ml_get_buf(buf, lnum, false);
|
||||||
}
|
}
|
||||||
if (!match_ok)
|
if (!match_ok)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user