ruby-changes:41629
From: nobu <ko1@a...>
Date: Mon, 1 Feb 2016 15:24:20 +0900 (JST)
Subject: [ruby-changes:41629] nobu:r53703 (trunk): win32.c: move counting length
nobu 2016-02-01 15:25:21 +0900 (Mon, 01 Feb 2016) New Revision: 53703 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53703 Log: win32.c: move counting length * win32/win32.c (opendir_internal): defer counting the length just before the loop where it is used. Modified files: trunk/win32/win32.c Index: win32/win32.c =================================================================== --- win32/win32.c (revision 53702) +++ win32/win32.c (revision 53703) @@ -1931,7 +1931,6 @@ opendir_internal(WCHAR *wpath, const cha https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1931 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 cha https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1949 if (p == NULL) return NULL; + pathlen = lstrlenW(wpath); idx = 0; // -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/