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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202012111911.0BBJBGOJ2591855%40masaka.moolenaar.net.

Raspunde prin e-mail lui