summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-04 05:49:35 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-04 05:49:35 +0000
commitdf11c9c5e2ad9ed35008ffce583809d1e80ba80e (patch)
tree1531af91936eeb2d004c0d46bb08cc689ae1ffd1 /enum.c
parent5c19a5fa247f173eb7d41048f3e1a4beb4e4e0c4 (diff)
enum.c: remove volatile, use RB_GC_GUARD
volatile appears unnecessary in most cases as the VALUEs are used as arguments of uninlined functions. Even worse, volatile can be insufficient in places where RB_GC_GUARD is necessary. * enum.c (zip_ary): remove volatile, use RB_GC_GUARD (zip_i): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/enum.c b/enum.c
index db17c04..e704a0d 100644
--- a/enum.c
+++ b/enum.c
@@ -2350,10 +2350,10 @@ static VALUE
zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
{
struct MEMO *memo = (struct MEMO *)memoval;
- volatile VALUE result = memo->v1;
- volatile VALUE args = memo->v2;
+ VALUE result = memo->v1;
+ VALUE args = memo->v2;
long n = memo->u3.cnt++;
- volatile VALUE tmp;
+ VALUE tmp;
int i;
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
@@ -2374,6 +2374,9 @@ zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
else {
rb_ary_push(result, tmp);
}
+
+ RB_GC_GUARD(args);
+
return Qnil;
}
@@ -2393,9 +2396,9 @@ static VALUE
zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
{
struct MEMO *memo = (struct MEMO *)memoval;
- volatile VALUE result = memo->v1;
- volatile VALUE args = memo->v2;
- volatile VALUE tmp;
+ VALUE result = memo->v1;
+ VALUE args = memo->v2;
+ VALUE tmp;
int i;
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
@@ -2422,6 +2425,9 @@ zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
else {
rb_ary_push(result, tmp);
}
+
+ RB_GC_GUARD(args);
+
return Qnil;
}