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

@@ -5101,14 +5101,13 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
}
p1 = vim_strchr(IObuff, '*'); /* find first '*' */
while (p1 != NULL) {
/* Use vim_strbyte() instead of vim_strchr() so that when
* 'encoding' is dbcs it still works, don't find '*' in the
* second byte. */
p2 = vim_strbyte(p1 + 1, '*'); /* find second '*' */
if (p2 != NULL && p2 > p1 + 1) { /* skip "*" and "**" */
for (s = p1 + 1; s < p2; ++s)
if (*s == ' ' || *s == '\t' || *s == '|')
p2 = (char_u *)strchr((const char *)p1 + 1, '*'); // Find second '*'.
if (p2 != NULL && p2 > p1 + 1) { // Skip "*" and "**".
for (s = p1 + 1; s < p2; s++) {
if (*s == ' ' || *s == '\t' || *s == '|') {
break;
}
}
/*
* Only accept a *tag* when it consists of valid