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;
|
buf_T *buf = NULL;
|
||||||
|
|
||||||
/* First make the name into a full path name */
|
/* First make the name into a full path name */
|
||||||
ffname = FullName_save(fname,
|
ffname = (char_u *)FullName_save((char *)fname,
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
TRUE /* force expansion, get rid of symbolic links */
|
TRUE /* force expansion, get rid of symbolic links */
|
||||||
#else
|
#else
|
||||||
|
@ -867,7 +867,7 @@ void ex_diffpatch(exarg_T *eap)
|
|||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
// Get the absolute path of the patchfile, changing directory below.
|
// 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
|
#endif // ifdef UNIX
|
||||||
|
|
||||||
#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. */
|
/* If there is no file name there will be no undo file. */
|
||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
} else {
|
} else {
|
||||||
char_u *ffname = FullName_save(fname, FALSE);
|
char_u *ffname = (char_u *)FullName_save((char *)fname, FALSE);
|
||||||
|
|
||||||
if (ffname != NULL)
|
if (ffname != NULL)
|
||||||
rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE);
|
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. */
|
/* FullName_save() is slow, don't use it when not needed. */
|
||||||
if (*p != NUL || !vim_isAbsName(*fnamep)) {
|
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 */
|
xfree(*bufp); /* free any allocated file name */
|
||||||
*bufp = *fnamep;
|
*bufp = *fnamep;
|
||||||
if (*fnamep == NULL)
|
if (*fnamep == NULL)
|
||||||
@ -19940,7 +19940,7 @@ repeat:
|
|||||||
if (c == '.' && **fnamep == '~')
|
if (c == '.' && **fnamep == '~')
|
||||||
p = pbuf = expand_env_save(*fnamep);
|
p = pbuf = expand_env_save(*fnamep);
|
||||||
else
|
else
|
||||||
p = pbuf = FullName_save(*fnamep, FALSE);
|
p = pbuf = (char_u *)FullName_save((char *)*fnamep, FALSE);
|
||||||
} else
|
} else
|
||||||
p = *fnamep;
|
p = *fnamep;
|
||||||
|
|
||||||
|
@ -8155,7 +8155,7 @@ eval_vars (
|
|||||||
/* Still need to turn the fname into a full path. It is
|
/* Still need to turn the fname into a full path. It is
|
||||||
* postponed to avoid a delay when <afile> is not used. */
|
* postponed to avoid a delay when <afile> is not used. */
|
||||||
autocmd_fname_full = TRUE;
|
autocmd_fname_full = TRUE;
|
||||||
result = FullName_save(autocmd_fname, FALSE);
|
result = (char_u *)FullName_save((char *)autocmd_fname, FALSE);
|
||||||
xfree(autocmd_fname);
|
xfree(autocmd_fname);
|
||||||
autocmd_fname = result;
|
autocmd_fname = result;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ vim_findfile_init (
|
|||||||
if (!vim_isAbsName(rel_fname) && len + 1 < MAXPATHL) {
|
if (!vim_isAbsName(rel_fname) && len + 1 < MAXPATHL) {
|
||||||
/* Make the start dir an absolute path name. */
|
/* Make the start dir an absolute path name. */
|
||||||
STRLCPY(ff_expand_buffer, rel_fname, len + 1);
|
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
|
} else
|
||||||
search_ctx->ffsc_start_dir = vim_strnsave(rel_fname, len);
|
search_ctx->ffsc_start_dir = vim_strnsave(rel_fname, len);
|
||||||
if (*++path != NUL)
|
if (*++path != NUL)
|
||||||
|
@ -6599,7 +6599,7 @@ apply_autocmds_group (
|
|||||||
|| event == EVENT_TABCLOSED)
|
|| event == EVENT_TABCLOSED)
|
||||||
fname = vim_strsave(fname);
|
fname = vim_strsave(fname);
|
||||||
else
|
else
|
||||||
fname = FullName_save(fname, FALSE);
|
fname = (char_u *)FullName_save((char *)fname, FALSE);
|
||||||
}
|
}
|
||||||
if (fname == NULL) { /* out of memory */
|
if (fname == NULL) { /* out of memory */
|
||||||
xfree(sfname);
|
xfree(sfname);
|
||||||
@ -6925,7 +6925,7 @@ int has_autocmd(event_T event, char_u *sfname, buf_T *buf)
|
|||||||
char_u *tail = path_tail(sfname);
|
char_u *tail = path_tail(sfname);
|
||||||
int retval = FALSE;
|
int retval = FALSE;
|
||||||
|
|
||||||
fname = FullName_save(sfname, FALSE);
|
fname = (char_u *)FullName_save((char *)sfname, FALSE);
|
||||||
if (fname == NULL)
|
if (fname == NULL)
|
||||||
return FALSE;
|
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.
|
/// name so we must work out the full path name.
|
||||||
void mf_set_ffname(memfile_T *mfp)
|
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.
|
/// 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);
|
p = (char_u *)vim_getenv((char *)envname);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
/* Set $MYVIMRC to the first vimrc file found. */
|
/* Set $MYVIMRC to the first vimrc file found. */
|
||||||
p = FullName_save(fname, FALSE);
|
p = (char_u *)FullName_save((char *)fname, FALSE);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
vim_setenv((char *)envname, (char *)p);
|
vim_setenv((char *)envname, (char *)p);
|
||||||
xfree(p);
|
xfree(p);
|
||||||
|
@ -358,28 +358,26 @@ void add_pathsep(char *p)
|
|||||||
strcat(p, PATHSEPSTR);
|
strcat(p, PATHSEPSTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Get an allocated copy of the full path to a file.
|
||||||
* FullName_save - Make an allocated copy of a full file name.
|
///
|
||||||
* Returns NULL when fname is NULL.
|
/// @param fname is the filename to save
|
||||||
*/
|
/// @param force is a flag to expand `fname` even if it looks absolute
|
||||||
char_u *
|
///
|
||||||
FullName_save (
|
/// @return [allocated] Copy of absolute path to `fname` or NULL when
|
||||||
char_u *fname,
|
/// `fname` is NULL.
|
||||||
int force /* force expansion, even when it already looks
|
char *FullName_save(char *fname, bool force)
|
||||||
* like a full path name */
|
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL
|
||||||
)
|
|
||||||
{
|
{
|
||||||
char_u *new_fname = NULL;
|
if (fname == NULL) {
|
||||||
|
|
||||||
if (fname == NULL)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
char_u *buf = xmalloc(MAXPATHL);
|
char *buf = xmalloc(MAXPATHL);
|
||||||
|
char *new_fname = NULL;
|
||||||
if (vim_FullName((char *)fname, (char *)buf, MAXPATHL, force) != FAIL) {
|
if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) {
|
||||||
new_fname = vim_strsave(buf);
|
new_fname = xstrdup(buf);
|
||||||
} else {
|
} else {
|
||||||
new_fname = vim_strsave(fname);
|
new_fname = xstrdup(fname);
|
||||||
}
|
}
|
||||||
xfree(buf);
|
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
|
FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
if (!path_is_absolute_path(name)) {
|
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);
|
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".
|
* For MS-Windows also expand names like "longna~1" to "longname".
|
||||||
*/
|
*/
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
return FullName_save(fname, TRUE);
|
return (char_u *)FullName_save((char *)fname, TRUE);
|
||||||
#else
|
#else
|
||||||
if (!vim_isAbsName(fname)
|
if (!vim_isAbsName(fname)
|
||||||
|| strstr((char *)fname, "..") != NULL
|
|| 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)[] */
|
/* check all files in (*file)[] */
|
||||||
for (i = 0; i < *num_file; ++i) {
|
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 */
|
if (ffname == NULL) /* out of memory */
|
||||||
break;
|
break;
|
||||||
if (match_file_list(p_wig, (*file)[i], ffname)) {
|
if (match_file_list(p_wig, (*file)[i], ffname)) {
|
||||||
|
@ -2380,7 +2380,7 @@ jumpto_tag (
|
|||||||
* into a fullpath
|
* into a fullpath
|
||||||
*/
|
*/
|
||||||
if (!curwin->w_p_pvw) {
|
if (!curwin->w_p_pvw) {
|
||||||
full_fname = FullName_save(fname, FALSE);
|
full_fname = (char_u *)FullName_save((char *)fname, FALSE);
|
||||||
fname = full_fname;
|
fname = full_fname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user