diff --git a/ChangeLog b/ChangeLog index d35ada9a27..86f9dde8cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 30 12:08:41 2013 Masaki Matsushita + + * array.c (rb_ary_uniq_bang): use rb_ary_modify_check() instead of + rb_ary_modify() because the array will be unshared soon. + Wed Oct 30 03:25:10 2013 Aaron Patterson * ext/psych/lib/psych/visitors/yaml_tree.rb: make less garbage when diff --git a/array.c b/array.c index 5e122a22f9..c7428c5b21 100644 --- a/array.c +++ b/array.c @@ -4111,7 +4111,7 @@ rb_ary_uniq_bang(VALUE ary) if (RARRAY_LEN(ary) == hash_size) { return Qnil; } - rb_ary_modify(ary); + rb_ary_modify_check(ary); ARY_SET_LEN(ary, 0); if (ARY_SHARED_P(ary) && !ARY_EMBED_P(ary)) { rb_ary_unshare(ary); @@ -4126,7 +4126,7 @@ rb_ary_uniq_bang(VALUE ary) if (RARRAY_LEN(ary) == hash_size) { return Qnil; } - rb_ary_modify(ary); + rb_ary_modify_check(ary); ARY_SET_LEN(ary, 0); if (ARY_SHARED_P(ary) && !ARY_EMBED_P(ary)) { rb_ary_unshare(ary);