Remove char_u: vim_FullName()

This commit is contained in:
Mark Bainter
2015-04-20 14:22:44 +00:00
parent 789c448d19
commit 657fd61973
5 changed files with 24 additions and 26 deletions

View File

@@ -3305,7 +3305,7 @@ static void script_host_execute(char *name, exarg_T *eap)
static void script_host_execute_file(char *name, exarg_T *eap) static void script_host_execute_file(char *name, exarg_T *eap)
{ {
uint8_t buffer[MAXPATHL]; uint8_t buffer[MAXPATHL];
vim_FullName(eap->arg, buffer, sizeof(buffer), false); vim_FullName((char *)eap->arg, (char *)buffer, sizeof(buffer), false);
list_T *args = list_alloc(); list_T *args = list_alloc();
// filename // filename

View File

@@ -7544,7 +7544,7 @@ static void ex_mkrc(exarg_T *eap)
char_u *tbuf; char_u *tbuf;
tbuf = xmalloc(MAXPATHL); tbuf = xmalloc(MAXPATHL);
if (vim_FullName(fname, tbuf, MAXPATHL, FALSE) == OK) if (vim_FullName((char *)fname, (char *)tbuf, MAXPATHL, FALSE) == OK)
set_vim_var_string(VV_THIS_SESSION, tbuf, -1); set_vim_var_string(VV_THIS_SESSION, tbuf, -1);
xfree(tbuf); xfree(tbuf);
} }
@@ -8975,7 +8975,7 @@ ses_arglist (
if (s != NULL) { if (s != NULL) {
if (fullname) { if (fullname) {
buf = xmalloc(MAXPATHL); buf = xmalloc(MAXPATHL);
(void)vim_FullName(s, buf, MAXPATHL, FALSE); (void)vim_FullName((char *)s, (char *)buf, MAXPATHL, FALSE);
s = buf; s = buf;
} }
if (fputs("argadd ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL if (fputs("argadd ", fd) < 0 || ses_put_fname(fd, s, flagp) == FAIL

View File

@@ -3049,7 +3049,7 @@ int resolve_symlink(char_u *fname, char_u *buf)
* be consistent even when opening a relative symlink from different * be consistent even when opening a relative symlink from different
* working directories. * working directories.
*/ */
return vim_FullName(tmp, buf, MAXPATHL, TRUE); return vim_FullName((char *)tmp, (char *)buf, MAXPATHL, TRUE);
} }
#endif #endif
@@ -3554,8 +3554,8 @@ fnamecmp_ino (
* One of the inode numbers is unknown, try a forced vim_FullName() and * One of the inode numbers is unknown, try a forced vim_FullName() and
* compare the file names. * compare the file names.
*/ */
retval_c = vim_FullName(fname_c, buf_c, MAXPATHL, TRUE); retval_c = vim_FullName((char *)fname_c, (char *)buf_c, MAXPATHL, TRUE);
retval_s = vim_FullName(fname_s, buf_s, MAXPATHL, TRUE); retval_s = vim_FullName((char *)fname_s, (char *)buf_s, MAXPATHL, TRUE);
if (retval_c == OK && retval_s == OK) if (retval_c == OK && retval_s == OK)
return STRCMP(buf_c, buf_s) != 0; return STRCMP(buf_c, buf_s) != 0;

View File

@@ -66,8 +66,8 @@ FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname)
if (!id_ok_1 && !id_ok_2) { if (!id_ok_1 && !id_ok_2) {
// If os_fileid() doesn't work, may compare the names. // If os_fileid() doesn't work, may compare the names.
if (checkname) { if (checkname) {
vim_FullName(exp1, full1, MAXPATHL, FALSE); vim_FullName((char *)exp1, (char *)full1, MAXPATHL, FALSE);
vim_FullName(s2, full2, MAXPATHL, FALSE); vim_FullName((char *)s2, (char *)full2, MAXPATHL, FALSE);
if (fnamecmp(full1, full2) == 0) { if (fnamecmp(full1, full2) == 0) {
return kEqualFileNames; return kEqualFileNames;
} }
@@ -376,7 +376,7 @@ FullName_save (
char_u *buf = xmalloc(MAXPATHL); char_u *buf = xmalloc(MAXPATHL);
if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) { if (vim_FullName((char *)fname, (char *)buf, MAXPATHL, force) != FAIL) {
new_fname = vim_strsave(buf); new_fname = vim_strsave(buf);
} else { } else {
new_fname = vim_strsave(fname); new_fname = vim_strsave(fname);
@@ -1552,18 +1552,16 @@ int vim_isAbsName(char_u *name)
return path_with_url((char *)name) != 0 || path_is_absolute_path(name); return path_with_url((char *)name) != 0 || path_is_absolute_path(name);
} }
/* /// Save absolute file name to "buf[len]".
* Get absolute file name into buffer "buf[len]". ///
* /// @param fname is the filename to evaluate
* return FAIL for failure, OK otherwise /// @param[out] buf is the buffer for returning the absolute path for `fname`
*/ /// @param len is the length of `buf`
int /// @param force is a flag to force expanding even if the path is absolute
vim_FullName ( ///
char_u *fname, /// @return FAIL for failure, OK otherwise
char_u *buf, int vim_FullName(char *fname, char *buf, int len, bool force)
int len, FUNC_ATTR_NONNULL_ARG(1)
int force /* force expansion even when already absolute */
)
{ {
int retval = OK; int retval = OK;
int url; int url;
@@ -1572,12 +1570,12 @@ vim_FullName (
if (fname == NULL) if (fname == NULL)
return FAIL; return FAIL;
url = path_with_url((char *)fname); url = path_with_url(fname);
if (!url) if (!url)
retval = path_get_absolute_path(fname, buf, len, force); retval = path_get_absolute_path((char_u *)fname, (char_u *)buf, len, force);
if (url || retval == FAIL) { if (url || retval == FAIL) {
/* something failed; use the file name (truncate when too long) */ /* something failed; use the file name (truncate when too long) */
STRLCPY(buf, fname, len); xstrlcpy(buf, fname, len);
} }
return retval; return retval;
} }
@@ -1698,7 +1696,7 @@ int same_directory(char_u *f1, char_u *f2)
if (f1 == NULL || f2 == NULL) if (f1 == NULL || f2 == NULL)
return FALSE; return FALSE;
(void)vim_FullName(f1, ffname, MAXPATHL, FALSE); (void)vim_FullName((char *)f1, (char *)ffname, MAXPATHL, FALSE);
t1 = path_tail_with_sep(ffname); t1 = path_tail_with_sep(ffname);
t2 = path_tail_with_sep(f2); t2 = path_tail_with_sep(f2);
return t1 - ffname == t2 - f2 return t1 - ffname == t2 - f2

View File

@@ -106,7 +106,7 @@ static bool vim_settempdir(char_u *tempdir)
if (!buf) { if (!buf) {
return false; return false;
} }
vim_FullName(tempdir, buf, MAXPATHL, false); vim_FullName((char *)tempdir, (char *)buf, MAXPATHL, false);
add_pathsep((char *)buf); add_pathsep((char *)buf);
vim_tempdir = vim_strsave(buf); vim_tempdir = vim_strsave(buf);
xfree(buf); xfree(buf);