To: vim_dev@googlegroups.com Subject: Patch 8.2.2129 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2129 Problem: MS-Windows: Checking if a file name is absolute is slow. Solution: Do not use mch_FullName(). (closes #7033) Files: src/os_mswin.c *** ../vim-8.2.2128/src/os_mswin.c 2020-05-17 14:06:07.313201564 +0200 --- src/os_mswin.c 2020-12-11 20:09:57.834114984 +0100 *************** *** 387,407 **** int mch_isFullName(char_u *fname) { ! // WinNT and later can use _MAX_PATH wide characters for a pathname, which ! // means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is ! // UTF-8. ! char szName[_MAX_PATH * 3 + 1]; ! ! // A name like "d:/foo" and "//server/share" is absolute ! if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\')) ! || (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\'))) ! return TRUE; ! ! // A name that can't be made absolute probably isn't absolute. ! if (mch_FullName(fname, (char_u *)szName, sizeof(szName) - 1, FALSE) == FAIL) ! return FALSE; ! ! return pathcmp((const char *)fname, (const char *)szName, -1) == 0; } /* --- 387,399 ---- int mch_isFullName(char_u *fname) { ! // A name like "d:/foo" and "//server/share" is absolute. "d:foo" is not. ! // Another way to check is to use mch_FullName() and see if the result is ! // the same as the name or mch_FullName() fails. However, this has quite a ! // bit of overhead, so let's not do that. ! return ((ASCII_ISALPHA(fname[0]) && fname[1] == ':' ! && (fname[2] == '/' || fname[2] == '\\')) ! || (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\'))); } /* *** ../vim-8.2.2128/src/version.c 2020-12-11 19:30:26.789393285 +0100 --- src/version.c 2020-12-11 20:08:40.102467420 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2129, /**/ -- [The rest of the ARMY stand around looking at a loss.] INSPECTOR END OF FILM: (picks up megaphone) All right! Clear off! Go on! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///