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

ruby-changes:18101

From: tarui <ko1@a...>
Date: Tue, 7 Dec 2010 22:42:49 +0900 (JST)
Subject: [ruby-changes:18101] Ruby:r30122 (trunk): * io.c (io_read): duplicate string if shared.

tarui	2010-12-07 22:38:36 +0900 (Tue, 07 Dec 2010)

  New Revision: 30122

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

  Log:
    * io.c (io_read): duplicate string if shared. [ruby-dev:42719]

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30121)
+++ ChangeLog	(revision 30122)
@@ -1,3 +1,7 @@
+Tue Dec  7 22:37:15 2010  Masaya Tarui  <tarui@r...>
+
+	* io.c (io_read): duplicate string if shared. [ruby-dev:42719]
+
 Tue Dec  7 22:31:08 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/optparse.rb (OptionParser::Officious): separate completion
Index: io.c
===================================================================
--- io.c	(revision 30121)
+++ io.c	(revision 30122)
@@ -2212,7 +2212,10 @@
     rb_scan_args(argc, argv, "02", &length, &str);
 
     if (NIL_P(length)) {
-	if (!NIL_P(str)) StringValue(str);
+	if (!NIL_P(str)){
+	    StringValue(str);
+	    rb_str_modify(str);
+	}
 	GetOpenFile(io, fptr);
 	rb_io_check_char_readable(fptr);
 	return read_all(fptr, remain_size(fptr), str);

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

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