refactor: replace char_u with char

Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
Dundar Goc
2022-07-31 16:20:57 +02:00
committed by dundargoc
parent f79773a3b4
commit 094cdf2d69
43 changed files with 499 additions and 537 deletions

View File

@@ -120,10 +120,10 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
}
// Loop over all entries in 'runtimepath'.
char_u *rtp = rtp_copy;
char *rtp = (char *)rtp_copy;
while (*rtp != NUL && ((flags & DIP_ALL) || !did_one)) {
// Copy the path from 'runtimepath' to buf[].
copy_option_part((char **)&rtp, buf, MAXPATHL, ",");
copy_option_part(&rtp, buf, MAXPATHL, ",");
size_t buflen = STRLEN(buf);
// Skip after or non-after directories.
@@ -144,12 +144,11 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
tail = (char_u *)buf + STRLEN(buf);
// Loop over all patterns in "name"
char_u *np = (char_u *)name;
char *np = name;
while (*np != NUL && ((flags & DIP_ALL) || !did_one)) {
// Append the pattern from "name" to buf[].
assert(MAXPATHL >= (tail - (char_u *)buf));
copy_option_part((char **)&np, (char *)tail, (size_t)(MAXPATHL - (tail - (char_u *)buf)),
"\t ");
copy_option_part(&np, (char *)tail, (size_t)(MAXPATHL - (tail - (char_u *)buf)), "\t ");
if (p_verbose > 10) {
verbose_enter();
@@ -278,11 +277,11 @@ int do_in_cached_path(char_u *name, int flags, DoInRuntimepathCB callback, void
tail = buf + STRLEN(buf);
// Loop over all patterns in "name"
char_u *np = name;
char *np = (char *)name;
while (*np != NUL && ((flags & DIP_ALL) || !did_one)) {
// Append the pattern from "name" to buf[].
assert(MAXPATHL >= (tail - buf));
copy_option_part((char **)&np, (char *)tail, (size_t)(MAXPATHL - (tail - buf)), "\t ");
copy_option_part(&np, (char *)tail, (size_t)(MAXPATHL - (tail - buf)), "\t ");
if (p_verbose > 10) {
verbose_enter();
@@ -1044,10 +1043,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 7;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "%s/%s*.vim", dirnames[i], pat);
globpath(p_rtp, s, &ga, 0);
globpath((char *)p_rtp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "%s/%s*.lua", dirnames[i], pat);
globpath(p_rtp, s, &ga, 0);
globpath((char *)p_rtp, s, &ga, 0);
}
xfree(s);
}
@@ -1057,10 +1056,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 22;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "pack/*/start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
}
xfree(s);
}
@@ -1069,10 +1068,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 22;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
}
xfree(s);
}
@@ -1083,10 +1082,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 20;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "pack/*/opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
}
xfree(s);
}
@@ -1095,10 +1094,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 20;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
}
xfree(s);
}
@@ -1151,9 +1150,9 @@ int ExpandPackAddDir(char_u *pat, int *num_file, char ***file)
size_t buflen = pat_len + 26;
char_u *s = xmalloc(buflen);
snprintf((char *)s, buflen, "pack/*/opt/%s*", pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
snprintf((char *)s, buflen, "opt/%s*", pat); // NOLINT
globpath(p_pp, s, &ga, 0);
globpath((char *)p_pp, s, &ga, 0);
xfree(s);
for (int i = 0; i < ga.ga_len; i++) {