mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
Merge from ruby_1_8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@16521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b524523217
commit
ab3d450a54
3 changed files with 27 additions and 4 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
Thu May 22 08:28:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (flatten): free memo hash table before raising exception.
|
||||
[ruby-dev:34789]
|
||||
|
||||
Thu May 22 06:30:10 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* array.c (flatten): fix memory leak.
|
||||
|
||||
Thu May 22 05:45:30 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_get_method_body, rb_alias, rb_eval): should not cache
|
||||
|
|
3
array.c
3
array.c
|
@ -3124,6 +3124,7 @@ flatten(ary, level, modified)
|
|||
*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 @@ flatten(ary, level, modified)
|
|||
ary = rb_ary_pop(stack);
|
||||
}
|
||||
|
||||
st_free_table(memo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
13
eval.c
13
eval.c
|
@ -8408,16 +8408,25 @@ proc_clone(self)
|
|||
* 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 @@ bind_eval(argc, argv, bindval)
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue