To: vim_dev@googlegroups.com Subject: Patch 8.2.4283 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4283 Problem: Using a variable for the return value is not needed. Solution: Return the value directly. (closes #9687) Files: src/ex_docmd.c, src/misc2.c *** ../vim-8.2.4282/src/ex_docmd.c 2022-01-31 18:59:09.840105788 +0000 --- src/ex_docmd.c 2022-02-02 13:15:46.272103295 +0000 *************** *** 7358,7364 **** { char_u *pdir = NULL; int dir_differs; ! int retval = FALSE; if (new_dir == NULL || allbuf_locked()) return FALSE; --- 7358,7365 ---- { char_u *pdir = NULL; int dir_differs; ! char_u *acmd_fname; ! char_u **pp; if (new_dir == NULL || allbuf_locked()) return FALSE; *************** *** 7415,7452 **** { emsg(_(e_command_failed)); vim_free(pdir); } else ! { ! char_u *acmd_fname; ! char_u **pp; if (scope == CDSCOPE_WINDOW) ! pp = &curwin->w_prevdir; else if (scope == CDSCOPE_TABPAGE) ! pp = &curtab->tp_prevdir; 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; } ! ! return retval; } /* --- 7416,7447 ---- { 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 ! 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); } ! return TRUE; } /* *** ../vim-8.2.4282/src/misc2.c 2022-01-31 14:59:33.518943700 +0000 --- src/misc2.c 2022-02-02 13:10:33.852771504 +0000 *************** *** 1903,1909 **** { char_u old_dir[MAXPATHL]; char_u new_dir[MAXPATHL]; - int res; if (mch_dirname(old_dir, MAXPATHL) != OK) *old_dir = NUL; --- 1903,1908 ---- *************** *** 1913,1928 **** 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; ! if (res == OK && trigger_autocmd != NULL) ! apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd, new_dir, FALSE, curbuf); ! } ! return res; } #endif --- 1912,1926 ---- if (pathcmp((char *)old_dir, (char *)new_dir, -1) == 0) // nothing to do ! return OK; ! if (mch_chdir((char *)new_dir) != 0) ! return FAIL; ! ! if (trigger_autocmd != NULL) ! apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd, new_dir, FALSE, curbuf); ! return OK; } #endif *** ../vim-8.2.4282/src/version.c 2022-02-01 17:26:09.334119249 +0000 --- src/version.c 2022-02-02 13:11:39.696629739 +0000 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4283, /**/ -- For large projects, Team Leaders use sophisticated project management software to keep track of who's doing what. The software collects the lies and guesses of the project team and organizes them in to instantly outdated charts that are too boring to look at closely. This is called "planning". (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///