ruby-changes:18644
From: kosaki <ko1@a...>
Date: Thu, 27 Jan 2011 18:56:24 +0900 (JST)
Subject: [ruby-changes:18644] Ruby:r30668 (trunk): * win32/win32.c (open_dir_handle): get rid of too huge alloca().
kosaki 2011-01-27 18:50:30 +0900 (Thu, 27 Jan 2011) New Revision: 30668 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30668 Log: * win32/win32.c (open_dir_handle): get rid of too huge alloca(). Modified files: trunk/ChangeLog trunk/win32/win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 30667) +++ ChangeLog (revision 30668) @@ -1,3 +1,7 @@ +Thu Jan 27 18:49:53 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * win32/win32.c (open_dir_handle): get rid of too huge alloca(). + Thu Jan 27 18:34:58 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * file.c (w32_io_info): get rid of too huge alloca(). Index: win32/win32.c =================================================================== --- win32/win32.c (revision 30667) +++ win32/win32.c (revision 30668) @@ -1654,12 +1654,13 @@ WCHAR *scanname; WCHAR *p; int len; + VALUE v; // // Create the search pattern // len = lstrlenW(filename); - scanname = ALLOCA_N(WCHAR, len + sizeof(wildcard) / sizeof(WCHAR)); + scanname = ALLOCV_N(WCHAR, v, len + sizeof(wildcard) / sizeof(WCHAR)); lstrcpyW(scanname, filename); p = CharPrevW(scanname, scanname + len); if (*p == L'/' || *p == L'\\' || *p == L':') @@ -1671,6 +1672,7 @@ // do the FindFirstFile call // fh = FindFirstFileW(scanname, fd); + ALLOCV_END(v); if (fh == INVALID_HANDLE_VALUE) { errno = map_errno(GetLastError()); } @@ -1799,7 +1801,6 @@ errno = ENOTDIR; return NULL; } - fh = open_dir_handle(wpath, &fd); free(wpath); return opendir_internal(fh, &fd); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/