ruby-changes:5028
From: knu <ko1@a...>
Date: Thu, 22 May 2008 12:32:02 +0900 (JST)
Subject: [ruby-changes:5028] knu - Ruby:r16521 (ruby_1_8_7): Merge from ruby_1_8.
knu 2008-05-22 12:31:43 +0900 (Thu, 22 May 2008) New Revision: 16521 Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/array.c branches/ruby_1_8_7/eval.c Log: Merge from ruby_1_8. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/eval.c?r1=16521&r2=16520&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/ChangeLog?r1=16521&r2=16520&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/array.c?r1=16521&r2=16520&diff_format=u Index: ruby_1_8_7/array.c =================================================================== --- ruby_1_8_7/array.c (revision 16520) +++ ruby_1_8_7/array.c (revision 16521) @@ -3124,6 +3124,7 @@ *modified = 1; id = (st_data_t)tmp; if (st_lookup(memo, id, 0)) { + st_free_table(memo); rb_raise(rb_eArgError, "tried to flatten recursive array"); } st_insert(memo, id, (st_data_t)Qtrue); @@ -3143,6 +3144,8 @@ ary = rb_ary_pop(stack); } + st_free_table(memo); + return result; } Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 16520) +++ ruby_1_8_7/ChangeLog (revision 16521) @@ -1,3 +1,18 @@ +Thu May 22 08:28:49 2008 Yukihiro Matsumoto <matz@r...> + + * array.c (flatten): free memo hash table before raising exception. + [ruby-dev:34789] + +Thu May 22 06:30:10 2008 Hidetoshi NAGAI <nagai@a...> + + * array.c (flatten): fix memory leak. + +Thu May 22 05:45:30 2008 Yukihiro Matsumoto <matz@r...> + + * proc.c (proc_dup): should copy safe_level from src proc + properly. a patch from Keita Yamaguchi + <keita.yamaguchi at gmail.com> + Wed May 21 23:31:44 2008 Nobuyoshi Nakada <nobu@r...> * eval.c (rb_get_method_body, rb_alias, rb_eval): should not cache Index: ruby_1_8_7/eval.c =================================================================== --- ruby_1_8_7/eval.c (revision 16520) +++ ruby_1_8_7/eval.c (revision 16521) @@ -8408,16 +8408,25 @@ * MISSING: documentation */ +#define PROC_TSHIFT (FL_USHIFT+1) +#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3) +#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT) + +static int proc_get_safe_level(VALUE); + static VALUE proc_dup(self) VALUE self; { struct BLOCK *orig, *data; VALUE bind; + int safe = proc_get_safe_level(self); Data_Get_Struct(self, struct BLOCK, orig); bind = Data_Make_Struct(rb_obj_class(self),struct BLOCK,blk_mark,blk_free,data); blk_dup(data, orig); + if (safe > PROC_TMAX) safe = PROC_TMAX; + FL_SET(bind, (safe << PROC_TSHIFT) & PROC_TMASK); return bind; } @@ -8521,10 +8530,6 @@ return rb_f_eval(argc+1, args, Qnil /* self will be searched in eval */); } -#define PROC_TSHIFT (FL_USHIFT+1) -#define PROC_TMASK (FL_USER1|FL_USER2|FL_USER3) -#define PROC_TMAX (PROC_TMASK >> PROC_TSHIFT) - #define SAFE_LEVEL_MAX PROC_TMASK static void -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/