[前][次][番号順一覧][スレッド一覧]

ruby-changes:37396

From: nobu <ko1@a...>
Date: Tue, 3 Feb 2015 13:43:59 +0900 (JST)
Subject: [ruby-changes:37396] nobu:r49477 (trunk): dir.c: GC guard

nobu	2015-02-03 13:43:52 +0900 (Tue, 03 Feb 2015)

  New Revision: 49477

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49477

  Log:
    dir.c: GC guard
    
    * dir.c (do_opendir): prevent intermediate string for transcoding
      from GC.

  Modified files:
    trunk/dir.c
Index: dir.c
===================================================================
--- dir.c	(revision 49476)
+++ dir.c	(revision 49477)
@@ -1134,7 +1134,7 @@ do_opendir(const char *path, int flags, https://github.com/ruby/ruby/blob/trunk/dir.c#L1134
 {
     DIR *dirp;
 #ifdef _WIN32
-    volatile VALUE tmp;
+    VALUE tmp = 0;
     if (enc != rb_usascii_encoding() &&
 	enc != rb_ascii8bit_encoding() &&
 	enc != rb_utf8_encoding()) {
@@ -1146,6 +1146,9 @@ do_opendir(const char *path, int flags, https://github.com/ruby/ruby/blob/trunk/dir.c#L1146
     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;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]