mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Remove char_u: FullName_save()
This commit is contained in:
parent
657fd61973
commit
80180bf94e
@ -1661,7 +1661,7 @@ buf_T *buflist_findname_exp(char_u *fname)
|
||||
buf_T *buf = NULL;
|
||||
|
||||
/* First make the name into a full path name */
|
||||
ffname = FullName_save(fname,
|
||||
ffname = (char_u *)FullName_save((char *)fname,
|
||||
#ifdef UNIX
|
||||
TRUE /* force expansion, get rid of symbolic links */
|
||||
#else
|
||||
|
@ -867,7 +867,7 @@ void ex_diffpatch(exarg_T *eap)
|
||||
|
||||
#ifdef UNIX
|
||||
// Get the absolute path of the patchfile, changing directory below.
|
||||
fullname = FullName_save(eap->arg, FALSE);
|
||||
fullname = (char_u *)FullName_save((char *)eap->arg, FALSE);
|
||||
#endif // ifdef UNIX
|
||||
|
||||
#ifdef UNIX
|
||||
|
@ -15484,7 +15484,7 @@ static void f_undofile(typval_T *argvars, typval_T *rettv)
|
||||
/* If there is no file name there will be no undo file. */
|
||||
rettv->vval.v_string = NULL;
|
||||
} else {
|
||||
char_u *ffname = FullName_save(fname, FALSE);
|
||||
char_u *ffname = (char_u *)FullName_save((char *)fname, FALSE);
|
||||
|
||||
if (ffname != NULL)
|
||||
rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE);
|
||||
@ -19906,7 +19906,7 @@ repeat:
|
||||
|
||||
/* FullName_save() is slow, don't use it when not needed. */
|
||||
if (*p != NUL || !vim_isAbsName(*fnamep)) {
|
||||
*fnamep = FullName_save(*fnamep, *p != NUL);
|
||||
*fnamep = (char_u *)FullName_save((char *)*fnamep, *p != NUL);
|
||||
xfree(*bufp); /* free any allocated file name */
|
||||
*bufp = *fnamep;
|
||||
if (*fnamep == NULL)
|
||||
@ -19940,7 +19940,7 @@ repeat:
|
||||
if (c == '.' && **fnamep == '~')
|
||||
p = pbuf = expand_env_save(*fnamep);
|
||||
else
|
||||
p = pbuf = FullName_save(*fnamep, FALSE);
|
||||
p = pbuf = (char_u *)FullName_save((char *)*fnamep, FALSE);
|
||||
} else
|
||||
p = *fnamep;
|
||||
|
||||
|
@ -8155,7 +8155,7 @@ eval_vars (
|
||||
/* Still need to turn the fname into a full path. It is
|
||||
* postponed to avoid a delay when <afile> is not used. */
|
||||
autocmd_fname_full = TRUE;
|
||||
result = FullName_save(autocmd_fname, FALSE);
|
||||
result = (char_u *)FullName_save((char *)autocmd_fname, FALSE);
|
||||
xfree(autocmd_fname);
|
||||
autocmd_fname = result;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ vim_findfile_init (
|
||||
if (!vim_isAbsName(rel_fname) && len + 1 < MAXPATHL) {
|
||||
/* Make the start dir an absolute path name. */
|
||||
STRLCPY(ff_expand_buffer, rel_fname, len + 1);
|
||||
search_ctx->ffsc_start_dir = FullName_save(ff_expand_buffer, FALSE);
|
||||
search_ctx->ffsc_start_dir = (char_u *)FullName_save((char *)ff_expand_buffer, FALSE);
|
||||
} else
|
||||
search_ctx->ffsc_start_dir = vim_strnsave(rel_fname, len);
|
||||
if (*++path != NUL)
|
||||
|
@ -6599,7 +6599,7 @@ apply_autocmds_group (
|
||||
|| event == EVENT_TABCLOSED)
|
||||
fname = vim_strsave(fname);
|
||||
else
|
||||
fname = FullName_save(fname, FALSE);
|
||||
fname = (char_u *)FullName_save((char *)fname, FALSE);
|
||||
}
|
||||
if (fname == NULL) { /* out of memory */
|
||||
xfree(sfname);
|
||||
@ -6925,7 +6925,7 @@ int has_autocmd(event_T event, char_u *sfname, buf_T *buf)
|
||||
char_u *tail = path_tail(sfname);
|
||||
int retval = FALSE;
|
||||
|
||||
fname = FullName_save(sfname, FALSE);
|
||||
fname = (char_u *)FullName_save((char *)sfname, FALSE);
|
||||
if (fname == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -893,7 +893,7 @@ blocknr_T mf_trans_del(memfile_T *mfp, blocknr_T old_nr)
|
||||
/// name so we must work out the full path name.
|
||||
void mf_set_ffname(memfile_T *mfp)
|
||||
{
|
||||
mfp->mf_ffname = FullName_save(mfp->mf_fname, false);
|
||||
mfp->mf_ffname = (char_u *)FullName_save((char *)mfp->mf_fname, false);
|
||||
}
|
||||
|
||||
/// Make name of memfile's swapfile a full path.
|
||||
|
@ -7390,7 +7390,7 @@ void vimrc_found(char_u *fname, char_u *envname)
|
||||
p = (char_u *)vim_getenv((char *)envname);
|
||||
if (p == NULL) {
|
||||
/* Set $MYVIMRC to the first vimrc file found. */
|
||||
p = FullName_save(fname, FALSE);
|
||||
p = (char_u *)FullName_save((char *)fname, FALSE);
|
||||
if (p != NULL) {
|
||||
vim_setenv((char *)envname, (char *)p);
|
||||
xfree(p);
|
||||
|
@ -358,28 +358,26 @@ void add_pathsep(char *p)
|
||||
strcat(p, PATHSEPSTR);
|
||||
}
|
||||
|
||||
/*
|
||||
* FullName_save - Make an allocated copy of a full file name.
|
||||
* Returns NULL when fname is NULL.
|
||||
*/
|
||||
char_u *
|
||||
FullName_save (
|
||||
char_u *fname,
|
||||
int force /* force expansion, even when it already looks
|
||||
* like a full path name */
|
||||
)
|
||||
/// Get an allocated copy of the full path to a file.
|
||||
///
|
||||
/// @param fname is the filename to save
|
||||
/// @param force is a flag to expand `fname` even if it looks absolute
|
||||
///
|
||||
/// @return [allocated] Copy of absolute path to `fname` or NULL when
|
||||
/// `fname` is NULL.
|
||||
char *FullName_save(char *fname, bool force)
|
||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
char_u *new_fname = NULL;
|
||||
|
||||
if (fname == NULL)
|
||||
if (fname == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char_u *buf = xmalloc(MAXPATHL);
|
||||
|
||||
if (vim_FullName((char *)fname, (char *)buf, MAXPATHL, force) != FAIL) {
|
||||
new_fname = vim_strsave(buf);
|
||||
char *buf = xmalloc(MAXPATHL);
|
||||
char *new_fname = NULL;
|
||||
if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) {
|
||||
new_fname = xstrdup(buf);
|
||||
} else {
|
||||
new_fname = vim_strsave(fname);
|
||||
new_fname = xstrdup(fname);
|
||||
}
|
||||
xfree(buf);
|
||||
|
||||
@ -393,7 +391,7 @@ char_u *save_absolute_path(const char_u *name)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
if (!path_is_absolute_path(name)) {
|
||||
return FullName_save((char_u *) name, true);
|
||||
return (char_u *)FullName_save((char *)name, true);
|
||||
}
|
||||
return vim_strsave((char_u *) name);
|
||||
}
|
||||
@ -1595,7 +1593,7 @@ char_u *fix_fname(char_u *fname)
|
||||
* For MS-Windows also expand names like "longna~1" to "longname".
|
||||
*/
|
||||
#ifdef UNIX
|
||||
return FullName_save(fname, TRUE);
|
||||
return (char_u *)FullName_save((char *)fname, TRUE);
|
||||
#else
|
||||
if (!vim_isAbsName(fname)
|
||||
|| strstr((char *)fname, "..") != NULL
|
||||
@ -1892,7 +1890,7 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file,
|
||||
|
||||
/* check all files in (*file)[] */
|
||||
for (i = 0; i < *num_file; ++i) {
|
||||
ffname = FullName_save((*file)[i], FALSE);
|
||||
ffname = (char_u *)FullName_save((char *)(*file)[i], FALSE);
|
||||
if (ffname == NULL) /* out of memory */
|
||||
break;
|
||||
if (match_file_list(p_wig, (*file)[i], ffname)) {
|
||||
|
@ -2380,7 +2380,7 @@ jumpto_tag (
|
||||
* into a fullpath
|
||||
*/
|
||||
if (!curwin->w_p_pvw) {
|
||||
full_fname = FullName_save(fname, FALSE);
|
||||
full_fname = (char_u *)FullName_save((char *)fname, FALSE);
|
||||
fname = full_fname;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user