Remove char_u: add_pathsep()

This commit is contained in:
Mark Bainter
2015-04-19 23:06:02 +00:00
parent 28ad7b5026
commit f813fdce38
11 changed files with 30 additions and 29 deletions

View File

@@ -12478,7 +12478,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
/* Ensure that the result will have a trailing path separator /* Ensure that the result will have a trailing path separator
* if the argument has one. */ * if the argument has one. */
if (remain == NULL && has_trailing_pathsep) if (remain == NULL && has_trailing_pathsep)
add_pathsep(buf); add_pathsep((char *)buf);
/* Separate the first path component in the link value and /* Separate the first path component in the link value and
* concatenate the remainders. */ * concatenate the remainders. */
@@ -19921,7 +19921,7 @@ repeat:
*bufp = *fnamep; *bufp = *fnamep;
if (*fnamep == NULL) if (*fnamep == NULL)
return -1; return -1;
add_pathsep(*fnamep); add_pathsep((char *)*fnamep);
} }
} }

View File

@@ -5126,7 +5126,7 @@ void fix_help_buffer(void)
char_u *cp; char_u *cp;
/* Find all "doc/ *.txt" files in this directory. */ /* Find all "doc/ *.txt" files in this directory. */
add_pathsep(NameBuff); add_pathsep((char *)NameBuff);
STRCAT(NameBuff, "doc/*.??[tx]"); STRCAT(NameBuff, "doc/*.??[tx]");
// Note: We cannot just do `&NameBuff` because it is a statically sized array // 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. */ /* Get a list of all files in the help directory and in subdirectories. */
STRCPY(NameBuff, dirname); STRCPY(NameBuff, dirname);
add_pathsep(NameBuff); add_pathsep((char *)NameBuff);
STRCAT(NameBuff, "**"); STRCAT(NameBuff, "**");
// Note: We cannot just do `&NameBuff` because it is a statically sized array // 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. * Do this before scanning through all the files.
*/ */
STRCPY(NameBuff, dir); STRCPY(NameBuff, dir);
add_pathsep(NameBuff); add_pathsep((char *)NameBuff);
STRCAT(NameBuff, tagfname); STRCAT(NameBuff, tagfname);
fd_tags = mch_fopen((char *)NameBuff, "w"); fd_tags = mch_fopen((char *)NameBuff, "w");
if (fd_tags == NULL) { if (fd_tags == NULL) {

View File

@@ -2144,7 +2144,7 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
if (!did_one) if (!did_one)
did_one = (cookie == NULL); did_one = (cookie == NULL);
} else if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL) { } else if (STRLEN(buf) + STRLEN(name) + 2 < MAXPATHL) {
add_pathsep(buf); add_pathsep((char *)buf);
tail = buf + STRLEN(buf); tail = buf + STRLEN(buf);
/* Loop over all patterns in "name" */ /* Loop over all patterns in "name" */

View File

@@ -9089,7 +9089,7 @@ static char_u *get_view_file(int c)
++len; ++len;
retval = xmalloc(STRLEN(sname) + len + STRLEN(p_vdir) + 9); retval = xmalloc(STRLEN(sname) + len + STRLEN(p_vdir) + 9);
STRCPY(retval, p_vdir); STRCPY(retval, p_vdir);
add_pathsep(retval); add_pathsep((char *)retval);
s = retval + STRLEN(retval); s = retval + STRLEN(retval);
for (p = sname; *p; ++p) { for (p = sname; *p; ++p) {
if (*p == '=') { if (*p == '=') {

View File

@@ -3890,7 +3890,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
if (l > MAXPATHL - 5) if (l > MAXPATHL - 5)
break; break;
STRLCPY(buf, s, l + 1); STRLCPY(buf, s, l + 1);
add_pathsep(buf); add_pathsep((char *)buf);
l = STRLEN(buf); l = STRLEN(buf);
STRLCPY(buf + l, pat, MAXPATHL - l); 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 one item of the path to buf[] and concatenate the file name.
copy_option_part(&path, buf, MAXPATHL, ","); copy_option_part(&path, buf, MAXPATHL, ",");
if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) { if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) {
add_pathsep(buf); add_pathsep((char *)buf);
STRCAT(buf, file); // NOLINT STRCAT(buf, file); // NOLINT
char_u **p; char_u **p;

View File

@@ -465,7 +465,7 @@ vim_findfile_init (
goto error_return; goto error_return;
} }
STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir); 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); size_t eb_len = STRLEN(ff_expand_buffer);
char_u *buf = xmalloc(eb_len + STRLEN(search_ctx->ffsc_fix_path) + 1); 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); STRCPY(buf + eb_len, search_ctx->ffsc_fix_path);
if (os_isdir(buf)) { if (os_isdir(buf)) {
STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path); STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
add_pathsep(ff_expand_buffer); add_pathsep((char *)ff_expand_buffer);
} else { } else {
char_u *p = path_tail(search_ctx->ffsc_fix_path); char_u *p = path_tail(search_ctx->ffsc_fix_path);
char_u *wc_path = NULL; char_u *wc_path = NULL;
@@ -484,7 +484,7 @@ vim_findfile_init (
if (p > search_ctx->ffsc_fix_path) { if (p > search_ctx->ffsc_fix_path) {
len = (int)(p - search_ctx->ffsc_fix_path) - 1; len = (int)(p - search_ctx->ffsc_fix_path) - 1;
STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len); STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len);
add_pathsep(ff_expand_buffer); add_pathsep((char *)ff_expand_buffer);
} else } else
len = (int)STRLEN(search_ctx->ffsc_fix_path); 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) if (!vim_isAbsName(stackp->ffs_fix_path)
&& search_ctx->ffsc_start_dir) { && search_ctx->ffsc_start_dir) {
STRCPY(file_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 */ /* append the fix part of the search path */
STRCAT(file_path, stackp->ffs_fix_path); STRCAT(file_path, stackp->ffs_fix_path);
add_pathsep(file_path); add_pathsep((char *)file_path);
rest_of_wildcards = stackp->ffs_wc_path; rest_of_wildcards = stackp->ffs_wc_path;
if (*rest_of_wildcards != NUL) { 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 /* prepare the filename to be checked for existence
* below */ * below */
STRCPY(file_path, stackp->ffs_filearray[i]); 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); STRCAT(file_path, search_ctx->ffsc_file_to_search);
/* /*
@@ -936,7 +936,7 @@ char_u *vim_findfile(void *search_ctx_arg)
break; break;
STRCPY(file_path, search_ctx->ffsc_start_dir); 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); STRCAT(file_path, search_ctx->ffsc_fix_path);
/* create a new stack entry */ /* create a new stack entry */

View File

@@ -1532,7 +1532,7 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
STRLCPY(resource->name, name, 64); STRLCPY(resource->name, name, 64);
/* Look for named resource file in runtimepath */ /* Look for named resource file in runtimepath */
STRCPY(buffer, "print"); STRCPY(buffer, "print");
add_pathsep(buffer); add_pathsep((char *)buffer);
vim_strcat(buffer, (char_u *)name, MAXPATHL); vim_strcat(buffer, (char_u *)name, MAXPATHL);
vim_strcat(buffer, (char_u *)".ps", MAXPATHL); vim_strcat(buffer, (char_u *)".ps", MAXPATHL);
resource->filename[0] = NUL; resource->filename[0] = NUL;

View File

@@ -625,7 +625,7 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
p = xmalloc(STRLEN((*file)[i]) + 1 + dir); p = xmalloc(STRLEN((*file)[i]) + 1 + dir);
STRCPY(p, (*file)[i]); STRCPY(p, (*file)[i]);
if (dir) if (dir)
add_pathsep(p); /* add '/' to a directory name */ add_pathsep((char *)p); /* add '/' to a directory name */
(*file)[j++] = p; (*file)[j++] = p;
} }
xfree(buffer); xfree(buffer);

View File

@@ -340,7 +340,7 @@ char_u *concat_fnames(char_u *fname1, char_u *fname2, int sep)
STRCPY(dest, fname1); STRCPY(dest, fname1);
if (sep) { if (sep) {
add_pathsep(dest); add_pathsep((char *)dest);
} }
STRCAT(dest, fname2); 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 * Add a path separator to a file name, unless it already ends in a path
* separator. * 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))) if (*p != NUL && !after_pathsep(p, p + strlen(p)))
STRCAT(p, PATHSEPSTR); 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 if (short_name != NULL && short_name > path + 1
) { ) {
STRCPY(path, "."); STRCPY(path, ".");
add_pathsep(path); add_pathsep((char *)path);
STRMOVE(path + STRLEN(path), short_name); 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); rel_path = xmalloc(STRLEN(short_name) + STRLEN(PATHSEPSTR) + 2);
STRCPY(rel_path, "."); STRCPY(rel_path, ".");
add_pathsep(rel_path); add_pathsep((char *)rel_path);
STRCAT(rel_path, short_name); STRCAT(rel_path, short_name);
xfree(fnames[i]); xfree(fnames[i]);
@@ -1278,7 +1279,7 @@ addfile (
* Append a slash or backslash after directory names if none is present. * Append a slash or backslash after directory names if none is present.
*/ */
if (isdir && (flags & EW_ADDSLASH)) if (isdir && (flags & EW_ADDSLASH))
add_pathsep(p); add_pathsep((char *)p);
GA_APPEND(char_u *, gap, 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 ":/" */ /* ignore a trailing slash, but not "//" or ":/" */
if (c2 == NUL if (c2 == NUL
&& i > 0 && i > 0
&& !after_pathsep(s, s + i) && !after_pathsep((char *)s, (char *)s + i)
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
&& (c1 == '/' || c1 == '\\') && (c1 == '/' || c1 == '\\')
#else #else

View File

@@ -3546,7 +3546,7 @@ void ex_helpgrep(exarg_T *eap)
copy_option_part(&p, NameBuff, MAXPATHL, ","); copy_option_part(&p, NameBuff, MAXPATHL, ",");
/* Find all "*.txt" and "*.??x" files in the "doc" directory. */ /* Find all "*.txt" and "*.??x" files in the "doc" directory. */
add_pathsep(NameBuff); add_pathsep((char *)NameBuff);
STRCAT(NameBuff, "doc/*.\\(txt\\|??x\\)"); STRCAT(NameBuff, "doc/*.\\(txt\\|??x\\)");
// Note: We cannot just do `&NameBuff` because it is a statically sized array // Note: We cannot just do `&NameBuff` because it is a statically sized array

View File

@@ -37,7 +37,7 @@ static void vim_maketempdir(void)
continue; continue;
} }
add_pathsep(template); add_pathsep((char *)template);
// Concatenate with temporary directory name pattern // Concatenate with temporary directory name pattern
STRCAT(template, "nvimXXXXXX"); STRCAT(template, "nvimXXXXXX");
@@ -107,7 +107,7 @@ static bool vim_settempdir(char_u *tempdir)
return false; return false;
} }
vim_FullName(tempdir, buf, MAXPATHL, false); vim_FullName(tempdir, buf, MAXPATHL, false);
add_pathsep(buf); add_pathsep((char *)buf);
vim_tempdir = vim_strsave(buf); vim_tempdir = vim_strsave(buf);
xfree(buf); xfree(buf);
return true; return true;