summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-14 09:42:14 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-14 09:42:14 +0000
commitf7cff3a940d7040416ebc4de2d532f2de46113af (patch)
treeec1fd2c9d33a33987eaaf4784ab1adcb04222498
parent4e3522e9fb1034cd16b714a197b9d7e1c3150e58 (diff)
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--string.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 178a0cf..d74226b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Feb 14 18:38:46 2014 Eric Wong <e@80x24.org>
+
+ * 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@ruby-lang.org>
* vm_insnhelper.c (vm_call_method): should check ci->me->flag of
diff --git a/string.c b/string.c
index 589c800..4e30cb3 100644
--- a/string.c
+++ b/string.c
@@ -1401,10 +1401,12 @@ rb_str_times(VALUE str, VALUE times)
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);
}