diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-02 13:16:37 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-02 13:16:37 +0000 |
commit | 73257149d759a8e6ddbe555d2b5aa37b6cb8db8b (patch) | |
tree | f4dc51a7a5969f822e1f2d151441125c10efd3d0 /src/ex_docmd.c | |
parent | adbb1bf21dad5697cd82d46d9dd9e8e8d0f647e6 (diff) | |
download | vim-git-73257149d759a8e6ddbe555d2b5aa37b6cb8db8b.tar.gz |
patch 8.2.4283: using a variable for the return value is not neededv8.2.4283
Problem: Using a variable for the return value is not needed.
Solution: Return the value directly. (closes #9687)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 64dcd7e2b..d8adf85bc 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -7358,7 +7358,8 @@ changedir_func( { char_u *pdir = NULL; int dir_differs; - int retval = FALSE; + char_u *acmd_fname; + char_u **pp; if (new_dir == NULL || allbuf_locked()) return FALSE; @@ -7415,38 +7416,32 @@ changedir_func( { emsg(_(e_command_failed)); vim_free(pdir); + return FALSE; } + + if (scope == CDSCOPE_WINDOW) + pp = &curwin->w_prevdir; + else if (scope == CDSCOPE_TABPAGE) + pp = &curtab->tp_prevdir; else - { - char_u *acmd_fname; - char_u **pp; + pp = &prev_dir; + vim_free(*pp); + *pp = pdir; + + post_chdir(scope); + if (dir_differs) + { if (scope == CDSCOPE_WINDOW) - pp = &curwin->w_prevdir; + acmd_fname = (char_u *)"window"; else if (scope == CDSCOPE_TABPAGE) - pp = &curtab->tp_prevdir; + acmd_fname = (char_u *)"tabpage"; else - pp = &prev_dir; - vim_free(*pp); - *pp = pdir; - - post_chdir(scope); - - if (dir_differs) - { - if (scope == CDSCOPE_WINDOW) - acmd_fname = (char_u *)"window"; - else if (scope == CDSCOPE_TABPAGE) - acmd_fname = (char_u *)"tabpage"; - else - acmd_fname = (char_u *)"global"; - apply_autocmds(EVENT_DIRCHANGED, acmd_fname, new_dir, FALSE, - curbuf); - } - retval = TRUE; + acmd_fname = (char_u *)"global"; + apply_autocmds(EVENT_DIRCHANGED, acmd_fname, new_dir, FALSE, + curbuf); } - - return retval; + return TRUE; } /* |