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

ruby-changes:32872

From: normal <ko1@a...>
Date: Fri, 14 Feb 2014 18:42:18 +0900 (JST)
Subject: [ruby-changes:32872] normal:r44951 (trunk): string.c (rb_str_format_m): trade volatile for RB_GC_GUARD

normal	2014-02-14 18:42:14 +0900 (Fri, 14 Feb 2014)

  New Revision: 44951

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

  Log:
    string.c (rb_str_format_m): trade volatile for RB_GC_GUARD
    
    * string.c (rb_str_format_m): trade volatile for RB_GC_GUARD
      RB_GC_GUARD meaning is clear and has better code generation.
      [ruby-core:60688]

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44950)
+++ ChangeLog	(revision 44951)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Feb 14 18:38:46 2014  Eric Wong  <e@8...>
+
+	* string.c (rb_str_format_m): trade volatile for RB_GC_GUARD
+	  RB_GC_GUARD meaning is clear and has better code generation.
+	  [ruby-core:60688]
+
 Thu Feb 13 23:30:30 2014  Shugo Maeda  <shugo@r...>
 
 	* vm_insnhelper.c (vm_call_method): should check ci->me->flag of
Index: string.c
===================================================================
--- string.c	(revision 44950)
+++ string.c	(revision 44951)
@@ -1401,10 +1401,12 @@ rb_str_times(VALUE str, VALUE times) https://github.com/ruby/ruby/blob/trunk/string.c#L1401
 static VALUE
 rb_str_format_m(VALUE str, VALUE arg)
 {
-    volatile VALUE tmp = rb_check_array_type(arg);
+    VALUE tmp = rb_check_array_type(arg);
 
     if (!NIL_P(tmp)) {
-	return rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
+	VALUE rv = rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
+	RB_GC_GUARD(tmp);
+	return rv;
     }
     return rb_str_format(1, &arg, str);
 }

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

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