From bb87f28346746d02aa7cb9ea7d49d03a3d8452ef Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 24 Jun 2006 14:52:59 +0000 Subject: * 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 --- ChangeLog | 16 +++++++++++++--- array.c | 2 +- eval.c | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16f87eec04..3c81be08a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sat Jun 24 23:37:41 2006 Tanaka Akira + + * 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] + Fri Jun 23 23:35:32 2006 Tanaka Akira * ruby.h, lib/drb/drb.rb, lib/drb/invokemethod.rb: remove Values class. @@ -266,7 +276,7 @@ Sat Jun 10 15:12:29 2006 NAKAMURA Usaku Sat Jun 10 10:13:13 2006 NAKAMURA Usaku - * lib/getoptlong.rb (GetoptLong#set_options): recieve arguments + * lib/getoptlong.rb (GetoptLong#set_options): receive arguments as Array. * lib/irb/slex.rb: use Proc#yield. @@ -303,7 +313,7 @@ Sat Jun 10 06:53:22 2006 NAKAMURA Usaku * eval.c (CALLARGS): remove last semicolon. C90 compiler doesn't allow any lines (even if they're empty) within variable - declaretions. + declarations. Fri Jun 9 09:56:32 2006 Yukihiro Matsumoto @@ -626,7 +636,7 @@ Sat May 13 16:14:05 2006 Tanaka Akira * lib/pp.rb (PP.mcall): new method. (Struct#pretty_print): call Kernel#class and Struct#members even if - overriden. + overridden. (Struct#pretty_print_cycle): ditto. [ruby-core:7865] diff --git a/array.c b/array.c index 79db7d4618..708a4900c0 100644 --- a/array.c +++ b/array.c @@ -163,8 +163,8 @@ rb_ary_new4(long n, const VALUE *elts) ary = rb_ary_new2(n); if (n > 0 && elts) { MEMCPY(RARRAY(ary)->ptr, elts, VALUE, n); + RARRAY(ary)->len = n; } - RARRAY(ary)->len = n; return ary; } 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; iptr[i] = va_arg(args, VALUE); -- cgit v1.2.3