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:
parent
28a7199ae0
commit
1664a4ca03
@ -1931,7 +1931,6 @@ opendir_internal(WCHAR *wpath, const char *filename)
|
|||||||
if (wstati64(wpath, &sbuf) < 0) {
|
if (wstati64(wpath, &sbuf) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pathlen = lstrlenW(wpath);
|
|
||||||
if (!(sbuf.st_mode & S_IFDIR) &&
|
if (!(sbuf.st_mode & S_IFDIR) &&
|
||||||
(!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
|
(!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
|
||||||
((1 << ((filename[0] & 0x5f) - 'A')) & GetLogicalDrives()) == 0)) {
|
((1 << ((filename[0] & 0x5f) - 'A')) & GetLogicalDrives()) == 0)) {
|
||||||
@ -1950,6 +1949,7 @@ opendir_internal(WCHAR *wpath, const char *filename)
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
pathlen = lstrlenW(wpath);
|
||||||
idx = 0;
|
idx = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user