mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Remove char_u: add_pathsep()
This commit is contained in:
parent
28ad7b5026
commit
f813fdce38
@ -12478,7 +12478,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
|
||||
/* Ensure that the result will have a trailing path separator
|
||||
* if the argument has one. */
|
||||
if (remain == NULL && has_trailing_pathsep)
|
||||
add_pathsep(buf);
|
||||
add_pathsep((char *)buf);
|
||||
|
||||
/* Separate the first path component in the link value and
|
||||
* concatenate the remainders. */
|
||||
@ -19921,7 +19921,7 @@ repeat:
|
||||
*bufp = *fnamep;
|
||||
if (*fnamep == NULL)
|
||||
return -1;
|
||||
add_pathsep(*fnamep);
|
||||
add_pathsep((char *)*fnamep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5126,7 +5126,7 @@ void fix_help_buffer(void)
|
||||
char_u *cp;
|
||||
|
||||
/* Find all "doc/ *.txt" files in this directory. */
|
||||
add_pathsep(NameBuff);
|
||||
add_pathsep((char *)NameBuff);
|
||||
STRCAT(NameBuff, "doc/*.??[tx]");
|
||||
|
||||
// Note: We cannot just do `&NameBuff` because it is a statically sized array
|
||||
@ -5297,7 +5297,7 @@ void ex_helptags(exarg_T *eap)
|
||||
|
||||
/* Get a list of all files in the help directory and in subdirectories. */
|
||||
STRCPY(NameBuff, dirname);
|
||||
add_pathsep(NameBuff);
|
||||
add_pathsep((char *)NameBuff);
|
||||
STRCAT(NameBuff, "**");
|
||||
|
||||
// Note: We cannot just do `&NameBuff` because it is a statically sized array
|
||||
@ -5419,7 +5419,7 @@ helptags_one (
|
||||
* Do this before scanning through all the files.
|
||||
*/
|
||||
STRCPY(NameBuff, dir);
|
||||
add_pathsep(NameBuff);
|
||||
add_pathsep((char *)NameBuff);
|
||||
STRCAT(NameBuff, tagfname);
|
||||
fd_tags = mch_fopen((char *)NameBuff, "w");
|
||||
if (fd_tags == NULL) {
|
||||
|
@ -2144,7 +2144,7 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
|
||||
if (!did_one)
|
||||
did_one = (cookie == NULL);
|
||||
} else if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL) {
|
||||
add_pathsep(buf);
|
||||
add_pathsep((char *)buf);
|
||||
tail = buf + STRLEN(buf);
|
||||
|
||||
/* Loop over all patterns in "name" */
|
||||
|
@ -9089,7 +9089,7 @@ static char_u *get_view_file(int c)
|
||||
++len;
|
||||
retval = xmalloc(STRLEN(sname) + len + STRLEN(p_vdir) + 9);
|
||||
STRCPY(retval, p_vdir);
|
||||
add_pathsep(retval);
|
||||
add_pathsep((char *)retval);
|
||||
s = retval + STRLEN(retval);
|
||||
for (p = sname; *p; ++p) {
|
||||
if (*p == '=') {
|
||||
|
@ -3890,7 +3890,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
|
||||
if (l > MAXPATHL - 5)
|
||||
break;
|
||||
STRLCPY(buf, s, l + 1);
|
||||
add_pathsep(buf);
|
||||
add_pathsep((char *)buf);
|
||||
l = STRLEN(buf);
|
||||
STRLCPY(buf + l, pat, MAXPATHL - l);
|
||||
|
||||
@ -4107,7 +4107,7 @@ void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options)
|
||||
// Copy one item of the path to buf[] and concatenate the file name.
|
||||
copy_option_part(&path, buf, MAXPATHL, ",");
|
||||
if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) {
|
||||
add_pathsep(buf);
|
||||
add_pathsep((char *)buf);
|
||||
STRCAT(buf, file); // NOLINT
|
||||
|
||||
char_u **p;
|
||||
|
@ -465,7 +465,7 @@ vim_findfile_init (
|
||||
goto error_return;
|
||||
}
|
||||
STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
|
||||
add_pathsep(ff_expand_buffer);
|
||||
add_pathsep((char *)ff_expand_buffer);
|
||||
{
|
||||
size_t eb_len = STRLEN(ff_expand_buffer);
|
||||
char_u *buf = xmalloc(eb_len + STRLEN(search_ctx->ffsc_fix_path) + 1);
|
||||
@ -474,7 +474,7 @@ vim_findfile_init (
|
||||
STRCPY(buf + eb_len, search_ctx->ffsc_fix_path);
|
||||
if (os_isdir(buf)) {
|
||||
STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
|
||||
add_pathsep(ff_expand_buffer);
|
||||
add_pathsep((char *)ff_expand_buffer);
|
||||
} else {
|
||||
char_u *p = path_tail(search_ctx->ffsc_fix_path);
|
||||
char_u *wc_path = NULL;
|
||||
@ -484,7 +484,7 @@ vim_findfile_init (
|
||||
if (p > search_ctx->ffsc_fix_path) {
|
||||
len = (int)(p - search_ctx->ffsc_fix_path) - 1;
|
||||
STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len);
|
||||
add_pathsep(ff_expand_buffer);
|
||||
add_pathsep((char *)ff_expand_buffer);
|
||||
} else
|
||||
len = (int)STRLEN(search_ctx->ffsc_fix_path);
|
||||
|
||||
@ -695,12 +695,12 @@ char_u *vim_findfile(void *search_ctx_arg)
|
||||
if (!vim_isAbsName(stackp->ffs_fix_path)
|
||||
&& search_ctx->ffsc_start_dir) {
|
||||
STRCPY(file_path, search_ctx->ffsc_start_dir);
|
||||
add_pathsep(file_path);
|
||||
add_pathsep((char *)file_path);
|
||||
}
|
||||
|
||||
/* append the fix part of the search path */
|
||||
STRCAT(file_path, stackp->ffs_fix_path);
|
||||
add_pathsep(file_path);
|
||||
add_pathsep((char *)file_path);
|
||||
|
||||
rest_of_wildcards = stackp->ffs_wc_path;
|
||||
if (*rest_of_wildcards != NUL) {
|
||||
@ -784,7 +784,7 @@ char_u *vim_findfile(void *search_ctx_arg)
|
||||
/* prepare the filename to be checked for existence
|
||||
* below */
|
||||
STRCPY(file_path, stackp->ffs_filearray[i]);
|
||||
add_pathsep(file_path);
|
||||
add_pathsep((char *)file_path);
|
||||
STRCAT(file_path, search_ctx->ffsc_file_to_search);
|
||||
|
||||
/*
|
||||
@ -936,7 +936,7 @@ char_u *vim_findfile(void *search_ctx_arg)
|
||||
break;
|
||||
|
||||
STRCPY(file_path, search_ctx->ffsc_start_dir);
|
||||
add_pathsep(file_path);
|
||||
add_pathsep((char *)file_path);
|
||||
STRCAT(file_path, search_ctx->ffsc_fix_path);
|
||||
|
||||
/* create a new stack entry */
|
||||
|
@ -1532,7 +1532,7 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
|
||||
STRLCPY(resource->name, name, 64);
|
||||
/* Look for named resource file in runtimepath */
|
||||
STRCPY(buffer, "print");
|
||||
add_pathsep(buffer);
|
||||
add_pathsep((char *)buffer);
|
||||
vim_strcat(buffer, (char_u *)name, MAXPATHL);
|
||||
vim_strcat(buffer, (char_u *)".ps", MAXPATHL);
|
||||
resource->filename[0] = NUL;
|
||||
|
@ -625,7 +625,7 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
p = xmalloc(STRLEN((*file)[i]) + 1 + dir);
|
||||
STRCPY(p, (*file)[i]);
|
||||
if (dir)
|
||||
add_pathsep(p); /* add '/' to a directory name */
|
||||
add_pathsep((char *)p); /* add '/' to a directory name */
|
||||
(*file)[j++] = p;
|
||||
}
|
||||
xfree(buffer);
|
||||
|
@ -340,7 +340,7 @@ char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep)
|
||||
|
||||
STRCPY(dest, fname1);
|
||||
if (sep) {
|
||||
add_pathsep(dest);
|
||||
add_pathsep((char *)dest);
|
||||
}
|
||||
STRCAT(dest, fname2);
|
||||
|
||||
@ -351,10 +351,11 @@ char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep)
|
||||
* Add a path separator to a file name, unless it already ends in a path
|
||||
* separator.
|
||||
*/
|
||||
void add_pathsep(char_u *p)
|
||||
void add_pathsep(char *p)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
if (*p != NUL && !after_pathsep((char *)p, (char *)p + STRLEN(p)))
|
||||
STRCAT(p, PATHSEPSTR);
|
||||
if (*p != NUL && !after_pathsep(p, p + strlen(p)))
|
||||
strcat(p, PATHSEPSTR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -880,7 +881,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
|
||||
if (short_name != NULL && short_name > path + 1
|
||||
) {
|
||||
STRCPY(path, ".");
|
||||
add_pathsep(path);
|
||||
add_pathsep((char *)path);
|
||||
STRMOVE(path + STRLEN(path), short_name);
|
||||
}
|
||||
}
|
||||
@ -907,7 +908,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
|
||||
|
||||
rel_path = xmalloc(STRLEN(short_name) + STRLEN(PATHSEPSTR) + 2);
|
||||
STRCPY(rel_path, ".");
|
||||
add_pathsep(rel_path);
|
||||
add_pathsep((char *)rel_path);
|
||||
STRCAT(rel_path, short_name);
|
||||
|
||||
xfree(fnames[i]);
|
||||
@ -1278,7 +1279,7 @@ addfile (
|
||||
* Append a slash or backslash after directory names if none is present.
|
||||
*/
|
||||
if (isdir && (flags & EW_ADDSLASH))
|
||||
add_pathsep(p);
|
||||
add_pathsep((char *)p);
|
||||
GA_APPEND(char_u *, gap, p);
|
||||
}
|
||||
|
||||
@ -1761,7 +1762,7 @@ int pathcmp(const char *p, const char *q, int maxlen)
|
||||
/* ignore a trailing slash, but not "//" or ":/" */
|
||||
if (c2 == NUL
|
||||
&& i > 0
|
||||
&& !after_pathsep(s, s + i)
|
||||
&& !after_pathsep((char *)s, (char *)s + i)
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
&& (c1 == '/' || c1 == '\\')
|
||||
#else
|
||||
|
@ -3546,7 +3546,7 @@ void ex_helpgrep(exarg_T *eap)
|
||||
copy_option_part(&p, NameBuff, MAXPATHL, ",");
|
||||
|
||||
/* Find all "*.txt" and "*.??x" files in the "doc" directory. */
|
||||
add_pathsep(NameBuff);
|
||||
add_pathsep((char *)NameBuff);
|
||||
STRCAT(NameBuff, "doc/*.\\(txt\\|??x\\)");
|
||||
|
||||
// Note: We cannot just do `&NameBuff` because it is a statically sized array
|
||||
|
@ -37,7 +37,7 @@ static void vim_maketempdir(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
add_pathsep(template);
|
||||
add_pathsep((char *)template);
|
||||
// Concatenate with temporary directory name pattern
|
||||
STRCAT(template, "nvimXXXXXX");
|
||||
|
||||
@ -107,7 +107,7 @@ static bool vim_settempdir(char_u *tempdir)
|
||||
return false;
|
||||
}
|
||||
vim_FullName(tempdir, buf, MAXPATHL, false);
|
||||
add_pathsep(buf);
|
||||
add_pathsep((char *)buf);
|
||||
vim_tempdir = vim_strsave(buf);
|
||||
xfree(buf);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user