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

ruby-changes:32406

From: glass <ko1@a...>
Date: Thu, 2 Jan 2014 16:29:18 +0900 (JST)
Subject: [ruby-changes:32406] glass:r44485 (trunk): * io.c (io_fwrite): freeze converted str.

glass	2014-01-02 16:29:13 +0900 (Thu, 02 Jan 2014)

  New Revision: 44485

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

  Log:
    * io.c (io_fwrite): freeze converted str.

  Modified files:
    trunk/ChangeLog
    trunk/io.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44484)
+++ ChangeLog	(revision 44485)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jan  2 16:07:21 2014  Masaki Matsushita  <glass.saga@g...>
+
+	* io.c (io_fwrite): freeze converted str.
+
 Thu Jan  2 04:15:13 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* eval.c (rb_longjmp): remove an extra modifier from the forward
Index: io.c
===================================================================
--- io.c	(revision 44484)
+++ io.c	(revision 44485)
@@ -1358,7 +1358,11 @@ io_fwrite(VALUE str, rb_io_t *fptr, int https://github.com/ruby/ruby/blob/trunk/io.c#L1358
     }
 #endif
     str = do_writeconv(str, fptr, &converted);
-    if (!converted) str = rb_str_new_frozen(str);
+    if (converted)
+	OBJ_FREEZE(str);
+    else
+	str = rb_str_new_frozen(str);
+
     return io_binwrite(str, RSTRING_PTR(str), RSTRING_LEN(str),
 		       fptr, nosync);
 }

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

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