Merge #6460 from ZyX-I/1476-changes

Refactor functions which find character in a string
This commit is contained in:
Justin M. Keyes
2017-05-08 13:45:14 +02:00
committed by GitHub
6 changed files with 71 additions and 142 deletions

View File

@@ -4855,17 +4855,10 @@ static int failure_chance(nfa_state_T *state, int depth)
*/
static int skip_to_start(int c, colnr_T *colp)
{
char_u *s;
/* Used often, do some work to avoid call overhead. */
if (!ireg_ic
&& !has_mbyte
)
s = vim_strbyte(regline + *colp, c);
else
s = cstrchr(regline + *colp, c);
if (s == NULL)
const char_u *const s = cstrchr(regline + *colp, c);
if (s == NULL) {
return FAIL;
}
*colp = (int)(s - regline);
return OK;
}