summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-24 14:52:59 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-24 14:52:59 +0000
commitbb87f28346746d02aa7cb9ea7d49d03a3d8452ef (patch)
tree1737ebcf043cfd5e7cd2adb1f0b181b25f4ba24a /eval.c
parentb72f065343d876c6ea59cc7c883b8ee01b4e7506 (diff)
* eval.c (rb_eval): use rb_ary_new2 instead of rb_ary_new4 to avoid
GC problem. (rb_yield_values): use rb_ary_new2 instead of rb_ary_new4. * array.c (rb_ary_new4): don't set len as n. make it safe with GC. [ruby-dev:28826] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index d94e5aaa60..d9afc3436f 100644
--- a/eval.c
+++ b/eval.c
@@ -3635,7 +3635,7 @@ rb_eval(VALUE self, NODE *n)
long i;
i = node->nd_alen;
- val = rb_ary_new4(i, 0);
+ val = rb_ary_new2(i);
for (i=0;node;node=node->nd_next) {
RARRAY(val)->ptr[i++] = rb_eval(self, node->nd_head);
RARRAY(val)->len = i;
@@ -4881,7 +4881,7 @@ rb_yield_values(int n, ...)
if (n == 0) {
return rb_yield_0(Qundef, 0, 0, 0);
}
- val = rb_ary_new4(n, 0);
+ val = rb_ary_new2(n);
va_start(args, n);
for (i=0; i<n; i++) {
RARRAY(val)->ptr[i] = va_arg(args, VALUE);