ruby-changes:8547
From: yugui <ko1@a...>
Date: Fri, 31 Oct 2008 22:56:25 +0900 (JST)
Subject: [ruby-changes:8547] Ruby:r20081 (ruby_1_9_1): merges r20071 from trunk into ruby_1_9_1.
yugui 2008-10-31 22:56:07 +0900 (Fri, 31 Oct 2008) New Revision: 20081 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20081 Log: merges r20071 from trunk into ruby_1_9_1. * array.c (rb_ary_decrement_share): fix to work recycling shared-array without the following. [ruby-dev:36991] * array.c (ary_make_substitution): don't recycle substitution array. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/array.c Index: ruby_1_9_1/array.c =================================================================== --- ruby_1_9_1/array.c (revision 20080) +++ ruby_1_9_1/array.c (revision 20081) @@ -177,7 +177,7 @@ { if (shared) { int num = ARY_SHARED_NUM(shared) - 1; - if (num == 0 && RBASIC(shared)->klass) { + if (num == 0) { rb_ary_free(shared); rb_gc_force_recycle(shared); } @@ -202,13 +202,19 @@ } } -static void -rb_ary_set_shared(VALUE ary, VALUE shared) -{ +static VALUE +rb_ary_increment_share(VALUE shared) { int num = ARY_SHARED_NUM(shared); if (num >= 0) { ARY_SET_SHARED_NUM(shared, num + 1); } + return shared; +} + +static void +rb_ary_set_shared(VALUE ary, VALUE shared) +{ + rb_ary_increment_share(shared); FL_SET_SHARED(ary); ARY_SET_SHARED(ary, shared); } @@ -396,7 +402,7 @@ return subst; } else { - return ary_make_shared(ary); + return rb_ary_increment_share(ary_make_shared(ary)); } } Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20080) +++ ruby_1_9_1/ChangeLog (revision 20081) @@ -1,3 +1,10 @@ +Fri Oct 31 12:42:45 2008 wanabe <s.wanabe@g...> + + * array.c (rb_ary_decrement_share): fix to work recycling + shared-array without the following. [ruby-dev:36991] + + * array.c (ary_make_substitution): don't recycle substitution array. + Fri Oct 31 11:35:38 2008 Nobuyoshi Nakada <nobu@r...> * encoding.c (rb_enc_set_default_internal): no alias "internal" if -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/