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/misc2.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/misc2.c')
-rw-r--r-- | src/misc2.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/misc2.c b/src/misc2.c index b6d5e066c..fac836fb7 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1903,7 +1903,6 @@ vim_chdirfile(char_u *fname, char *trigger_autocmd) { char_u old_dir[MAXPATHL]; char_u new_dir[MAXPATHL]; - int res; if (mch_dirname(old_dir, MAXPATHL) != OK) *old_dir = NUL; @@ -1913,16 +1912,15 @@ vim_chdirfile(char_u *fname, char *trigger_autocmd) if (pathcmp((char *)old_dir, (char *)new_dir, -1) == 0) // nothing to do - res = OK; - else - { - res = mch_chdir((char *)new_dir) == 0 ? OK : FAIL; + return OK; + + if (mch_chdir((char *)new_dir) != 0) + return FAIL; - if (res == OK && trigger_autocmd != NULL) - apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd, + if (trigger_autocmd != NULL) + apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd, new_dir, FALSE, curbuf); - } - return res; + return OK; } #endif |