mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 09:48:19 +00:00
vim-patch:8.2.4283: using a variable for the return value is not needed
Problem: Using a variable for the return value is not needed.
Solution: Return the value directly. (closes vim/vim#9687)
73257149d7
Also move down variable declarations in changedir_func().
vim_chdirfile() doesn't need change.
This commit is contained in:
@@ -7835,13 +7835,11 @@ void post_chdir(CdScope scope, bool trigger_dirchanged)
|
||||
/// @return true if the directory is successfully changed.
|
||||
bool changedir_func(char_u *new_dir, CdScope scope)
|
||||
{
|
||||
char_u *pdir = NULL;
|
||||
bool retval = false;
|
||||
|
||||
if (new_dir == NULL || allbuf_locked()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char_u *pdir = NULL;
|
||||
// ":cd -": Change to previous directory
|
||||
if (STRCMP(new_dir, "-") == 0) {
|
||||
pdir = get_prevdir(scope);
|
||||
@@ -7874,9 +7872,10 @@ bool changedir_func(char_u *new_dir, CdScope scope)
|
||||
if (dir_differs && vim_chdir(new_dir) != 0) {
|
||||
emsg(_(e_failed));
|
||||
xfree(pdir);
|
||||
} else {
|
||||
char_u **pp;
|
||||
return false;
|
||||
}
|
||||
|
||||
char_u **pp;
|
||||
switch (scope) {
|
||||
case kCdScopeTabpage:
|
||||
pp = &curtab->tp_prevdir;
|
||||
@@ -7891,10 +7890,8 @@ bool changedir_func(char_u *new_dir, CdScope scope)
|
||||
*pp = pdir;
|
||||
|
||||
post_chdir(scope, dir_differs);
|
||||
retval = true;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// ":cd", ":tcd", ":lcd", ":chdir", "tchdir" and ":lchdir".
|
||||
|
Reference in New Issue
Block a user