win32.c: move counting length

* win32/win32.c (opendir_internal): defer counting the length just
  before the loop where it is used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-02-01 06:25:21 +00:00
parent 28a7199ae0
commit 1664a4ca03

View File

@ -1931,7 +1931,6 @@ opendir_internal(WCHAR *wpath, const char *filename)
if (wstati64(wpath, &sbuf) < 0) {
return NULL;
}
pathlen = lstrlenW(wpath);
if (!(sbuf.st_mode & S_IFDIR) &&
(!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
((1 << ((filename[0] & 0x5f) - 'A')) & GetLogicalDrives()) == 0)) {
@ -1950,6 +1949,7 @@ opendir_internal(WCHAR *wpath, const char *filename)
if (p == NULL)
return NULL;
pathlen = lstrlenW(wpath);
idx = 0;
//