refactor: replace char_u variables and functions with char

Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
Dundar Goc
2022-05-04 22:35:50 +02:00
parent d9ec57e16a
commit 2a378e6e82
51 changed files with 508 additions and 506 deletions

View File

@@ -299,7 +299,7 @@ void shorten_dir_len(char_u *str, int trim_len)
skip = true;
}
}
int l = utfc_ptr2len(s);
int l = utfc_ptr2len((char *)s);
while (--l > 0) {
*d++ = *++s;
}
@@ -642,12 +642,12 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
} else if (path_end >= path + wildoff
&& (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL
#ifndef WIN32
|| (!p_fic && (flags & EW_ICASE) && mb_isalpha(utf_ptr2char(path_end)))
|| (!p_fic && (flags & EW_ICASE) && mb_isalpha(utf_ptr2char((char *)path_end)))
#endif
)) {
e = p;
}
len = (size_t)(utfc_ptr2len(path_end));
len = (size_t)(utfc_ptr2len((char *)path_end));
memcpy(p, path_end, len);
p += len;
path_end += len;
@@ -1980,8 +1980,8 @@ int pathcmp(const char *p, const char *q, int maxlen)
const char *s = NULL;
for (i = 0, j = 0; maxlen < 0 || (i < maxlen && j < maxlen);) {
c1 = utf_ptr2char((char_u *)p + i);
c2 = utf_ptr2char((char_u *)q + j);
c1 = utf_ptr2char(p + i);
c2 = utf_ptr2char(q + j);
// End of "p": check if "q" also ends or just has a slash.
if (c1 == NUL) {
@@ -2016,15 +2016,15 @@ int pathcmp(const char *p, const char *q, int maxlen)
: c1 - c2; // no match
}
i += utfc_ptr2len((char_u *)p + i);
j += utfc_ptr2len((char_u *)q + j);
i += utfc_ptr2len(p + i);
j += utfc_ptr2len(q + j);
}
if (s == NULL) { // "i" or "j" ran into "maxlen"
return 0;
}
c1 = utf_ptr2char((char_u *)s + i);
c2 = utf_ptr2char((char_u *)s + i + utfc_ptr2len((char_u *)s + i));
c1 = utf_ptr2char(s + i);
c2 = utf_ptr2char(s + i + utfc_ptr2len(s + i));
// ignore a trailing slash, but not "//" or ":/"
if (c2 == NUL
&& i > 0