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

ruby-changes:8422

From: naruse <ko1@a...>
Date: Mon, 27 Oct 2008 01:08:27 +0900 (JST)
Subject: [ruby-changes:8422] Ruby:r19953 (trunk): * ext/nkf/nkf.c (rb_nkf_convert): avoid GC.

naruse	2008-10-27 01:08:03 +0900 (Mon, 27 Oct 2008)

  New Revision: 19953

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

  Log:
    * ext/nkf/nkf.c (rb_nkf_convert): avoid GC.
      reported in [ruby-dev:36909] and patched [ruby-dev:36941] by mame.

  Modified files:
    trunk/ChangeLog
    trunk/ext/nkf/nkf.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19952)
+++ ChangeLog	(revision 19953)
@@ -1,3 +1,8 @@
+Mon Oct 27 01:05:48 2008  NARUSE, Yui  <naruse@r...>
+
+	* ext/nkf/nkf.c (rb_nkf_convert): avoid GC.
+	  reported in [ruby-dev:36909] and patched [ruby-dev:36941] by mame.
+
 Sun Oct 26 21:28:42 2008  Yusuke Endoh  <mame@t...>
 
 	* test/json/test_json.rb: remove dependency on permutation gem.
Index: ext/nkf/nkf.c
===================================================================
--- ext/nkf/nkf.c	(revision 19952)
+++ ext/nkf/nkf.c	(revision 19953)
@@ -135,6 +135,7 @@
 static VALUE
 rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
 {
+    volatile tmp;
     reinit();
     StringValue(opt);
     nkf_split_options(RSTRING_PTR(opt));
@@ -155,7 +156,7 @@
     StringValue(src);
     input = (unsigned char *)RSTRING_PTR(src);
     i_len = RSTRING_LEN(src);
-    result = rb_str_new(0, i_len*3 + 10);
+    tmp = result = rb_str_new(0, i_len*3 + 10);
 
     output_ctr = 0;
     output     = (unsigned char *)RSTRING_PTR(result);

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

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