ruby-changes:37572
From: naruse <ko1@a...>
Date: Fri, 20 Feb 2015 14:24:45 +0900 (JST)
Subject: [ruby-changes:37572] naruse:r49653 (ruby_2_2): merge revision(s) 49169, 49477:
naruse 2015-02-20 14:24:33 +0900 (Fri, 20 Feb 2015) New Revision: 49653 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49653 Log: merge revision(s) 49169,49477: dir.c: GC guard * dir.c (dir_initialize): add GC guard for retrying. the argument of RSTRING_PTR() may be eliminated by optimization. Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/dir.c branches/ruby_2_2/version.h Index: ruby_2_2/dir.c =================================================================== --- ruby_2_2/dir.c (revision 49652) +++ ruby_2_2/dir.c (revision 49653) @@ -445,6 +445,7 @@ dir_initialize(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_2/dir.c#L445 rb_encoding *fsenc; VALUE dirname, opt, orig; static ID keyword_ids[1]; + const char *path; if (!keyword_ids[0]) { keyword_ids[0] = rb_intern("encoding"); @@ -472,13 +473,15 @@ dir_initialize(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_2/dir.c#L473 dp->dir = NULL; dp->path = Qnil; dp->enc = fsenc; - dp->dir = opendir(RSTRING_PTR(dirname)); + path = RSTRING_PTR(dirname); + dp->dir = opendir(path); if (dp->dir == NULL) { if (errno == EMFILE || errno == ENFILE) { rb_gc(); - dp->dir = opendir(RSTRING_PTR(dirname)); + dp->dir = opendir(path); } if (dp->dir == NULL) { + RB_GC_GUARD(dirname); rb_sys_fail_path(orig); } } @@ -1122,7 +1125,7 @@ do_opendir(const char *path, int flags, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/dir.c#L1125 { DIR *dirp; #ifdef _WIN32 - volatile VALUE tmp; + VALUE tmp = 0; if (enc != rb_usascii_encoding() && enc != rb_ascii8bit_encoding() && enc != rb_utf8_encoding()) { @@ -1134,6 +1137,9 @@ do_opendir(const char *path, int flags, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/dir.c#L1137 dirp = opendir(path); if (dirp == NULL && !to_be_ignored(errno)) sys_warning(path); +#ifdef _WIN32 + if (tmp) rb_str_resize(tmp, 0); /* GC guard */ +#endif return dirp; } Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 49652) +++ ruby_2_2/version.h (revision 49653) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.0" -#define RUBY_RELEASE_DATE "2015-02-19" -#define RUBY_PATCHLEVEL 61 +#define RUBY_RELEASE_DATE "2015-02-20" +#define RUBY_PATCHLEVEL 62 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 19 +#define RUBY_RELEASE_DAY 20 #include "ruby/version.h" Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r49169,49477 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/