From f7cff3a940d7040416ebc4de2d532f2de46113af Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 14 Feb 2014 09:42:14 +0000 Subject: 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 --- string.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 589c80088e..4e30cb338a 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); } -- cgit v1.2.3