diff src/misc2.c @ 27511:9986f96fb1bd v8.2.4283

patch 8.2.4283: using a variable for the return value is not needed Commit: https://github.com/vim/vim/commit/73257149d759a8e6ddbe555d2b5aa37b6cb8db8b Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Feb 2 13:16:37 2022 +0000 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 https://github.com/vim/vim/issues/9687)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Feb 2022 14:30:04 +0100
parents fb4c30606b4a
children 269f89efb06a
line wrap: on
line diff
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1903,7 +1903,6 @@ vim_chdirfile(char_u *fname, char *trigg
 {
     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 *trigg
 
     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