Remove char_u: path_with_url()

This commit is contained in:
Mark Bainter
2015-04-20 13:50:57 +00:00
parent 3128ff3798
commit 789c448d19
4 changed files with 18 additions and 21 deletions

View File

@@ -7347,7 +7347,7 @@ static buf_T *find_buffer(typval_T *avar)
* buffer, these don't use the full path. */ * buffer, these don't use the full path. */
FOR_ALL_BUFFERS(bp) { FOR_ALL_BUFFERS(bp) {
if (bp->b_fname != NULL if (bp->b_fname != NULL
&& (path_with_url(bp->b_fname) && (path_with_url((char *)bp->b_fname)
|| bt_nofile(bp) || bt_nofile(bp)
) )
&& STRCMP(bp->b_fname, avar->vval.v_string) == 0) { && STRCMP(bp->b_fname, avar->vval.v_string) == 0) {

View File

@@ -749,7 +749,7 @@ char_u *vim_findfile(void *search_ctx_arg)
* Expand wildcards like "*" and "$VAR". * Expand wildcards like "*" and "$VAR".
* If the path is a URL don't try this. * If the path is a URL don't try this.
*/ */
if (path_with_url(dirptrs[0])) { if (path_with_url((char *)dirptrs[0])) {
stackp->ffs_filearray = (char_u **)xmalloc(sizeof(char *)); stackp->ffs_filearray = (char_u **)xmalloc(sizeof(char *));
stackp->ffs_filearray[0] = vim_strsave(dirptrs[0]); stackp->ffs_filearray[0] = vim_strsave(dirptrs[0]);
stackp->ffs_filearray_size = 1; stackp->ffs_filearray_size = 1;
@@ -777,7 +777,7 @@ char_u *vim_findfile(void *search_ctx_arg)
*/ */
for (int i = stackp->ffs_filearray_cur; for (int i = stackp->ffs_filearray_cur;
i < stackp->ffs_filearray_size; ++i) { i < stackp->ffs_filearray_size; ++i) {
if (!path_with_url(stackp->ffs_filearray[i]) if (!path_with_url((char *)stackp->ffs_filearray[i])
&& !os_isdir(stackp->ffs_filearray[i])) && !os_isdir(stackp->ffs_filearray[i]))
continue; /* not a directory */ continue; /* not a directory */
@@ -798,7 +798,7 @@ char_u *vim_findfile(void *search_ctx_arg)
suf = curbuf->b_p_sua; suf = curbuf->b_p_sua;
for (;; ) { for (;; ) {
/* if file exists and we didn't already find it */ /* if file exists and we didn't already find it */
if ((path_with_url(file_path) if ((path_with_url((char *)file_path)
|| (os_file_exists(file_path) || (os_file_exists(file_path)
&& (search_ctx->ffsc_find_what && (search_ctx->ffsc_find_what
== FINDFILE_BOTH == FINDFILE_BOTH
@@ -836,7 +836,7 @@ char_u *vim_findfile(void *search_ctx_arg)
stackp->ffs_filearray_cur = (char_u)(i + 1); stackp->ffs_filearray_cur = (char_u)(i + 1);
ff_push(search_ctx, stackp); ff_push(search_ctx, stackp);
if (!path_with_url(file_path)) if (!path_with_url((char *)file_path))
simplify_filename(file_path); simplify_filename(file_path);
if (os_dirname(ff_expand_buffer, MAXPATHL) if (os_dirname(ff_expand_buffer, MAXPATHL)
== OK) { == OK) {
@@ -1097,7 +1097,7 @@ static int ff_check_visited(ff_visited_T **visited_list, char_u *fname, char_u *
FileID file_id; FileID file_id;
// For an URL we only compare the name, otherwise we compare the // For an URL we only compare the name, otherwise we compare the
// device/inode. // device/inode.
if (path_with_url(fname)) { if (path_with_url((char *)fname)) {
STRLCPY(ff_expand_buffer, fname, MAXPATHL); STRLCPY(ff_expand_buffer, fname, MAXPATHL);
url = true; url = true;
} else { } else {
@@ -1404,7 +1404,7 @@ find_file_in_path_option (
* filename on the first call. * filename on the first call.
*/ */
if (first == TRUE) { if (first == TRUE) {
if (path_with_url(ff_file_to_find)) { if (path_with_url((char *)ff_file_to_find)) {
file_name = vim_strsave(ff_file_to_find); file_name = vim_strsave(ff_file_to_find);
goto theend; goto theend;
} }

View File

@@ -4310,7 +4310,7 @@ void shorten_fnames(int force)
FOR_ALL_BUFFERS(buf) { FOR_ALL_BUFFERS(buf) {
if (buf->b_fname != NULL if (buf->b_fname != NULL
&& !bt_nofile(buf) && !bt_nofile(buf)
&& !path_with_url(buf->b_fname) && !path_with_url((char *)buf->b_fname)
&& (force && (force
|| buf->b_sfname == NULL || buf->b_sfname == NULL
|| path_is_absolute_path(buf->b_sfname))) { || path_is_absolute_path(buf->b_sfname))) {

View File

@@ -734,7 +734,7 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
} else if (buf[0] == NUL) } else if (buf[0] == NUL)
/* relative to current directory */ /* relative to current directory */
STRCPY(buf, curdir); STRCPY(buf, curdir);
else if (path_with_url(buf)) else if (path_with_url((char *)buf))
/* URL can't be used here */ /* URL can't be used here */
continue; continue;
else if (!path_is_absolute_path(buf)) { else if (!path_is_absolute_path(buf)) {
@@ -1533,17 +1533,14 @@ int path_is_url(const char *p)
return 0; return 0;
} }
/* /// Check if "fname" starts with "name://". Return URL_SLASH if it does.
* Check if "fname" starts with "name://". Return URL_SLASH if it does. ///
* Return URL_BACKSLASH for "name:\\". /// @param fname is the filename to test
* Return zero otherwise. /// @return URL_BACKSLASH for "name:\\", zero otherwise.
*/ int path_with_url(const char *fname)
int path_with_url(char_u *fname)
{ {
char_u *p; const char *p;
for (p = fname; isalpha(*p); p++) {}
for (p = fname; isalpha(*p); ++p)
;
return path_is_url(p); return path_is_url(p);
} }
@@ -1552,7 +1549,7 @@ int path_with_url(char_u *fname)
*/ */
int vim_isAbsName(char_u *name) int vim_isAbsName(char_u *name)
{ {
return path_with_url(name) != 0 || path_is_absolute_path(name); return path_with_url((char *)name) != 0 || path_is_absolute_path(name);
} }
/* /*
@@ -1575,7 +1572,7 @@ vim_FullName (
if (fname == NULL) if (fname == NULL)
return FAIL; return FAIL;
url = path_with_url(fname); url = path_with_url((char *)fname);
if (!url) if (!url)
retval = path_get_absolute_path(fname, buf, len, force); retval = path_get_absolute_path(fname, buf, len, force);
if (url || retval == FAIL) { if (url || retval == FAIL) {