mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* array.c (rb_ary_uniq_bang): call ARY_SET_LEN(ary, 0) before
rb_resize_capa because rb_resize_capa expects resized length is smaller than current array length. call rb_ary_unshare before rb_resize_capa because rb_resize_capa losts the reference to original shared array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
627e79f13f
commit
88a9b87816
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Mon Jan 31 04:45:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* array.c (rb_ary_uniq_bang): call ARY_SET_LEN(ary, 0) before
|
||||||
|
rb_resize_capa because rb_resize_capa expects resized length is
|
||||||
|
smaller than current array length. call rb_ary_unshare before
|
||||||
|
rb_resize_capa because rb_resize_capa losts the reference to
|
||||||
|
original shared array.
|
||||||
|
|
||||||
Sun Jan 30 17:19:46 2011 Tanaka Akira <akr@fsij.org>
|
Sun Jan 30 17:19:46 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* missing/crypt.c: parenthesize macro arguments.
|
* missing/crypt.c: parenthesize macro arguments.
|
||||||
|
|
5
array.c
5
array.c
|
@ -3484,8 +3484,11 @@ rb_ary_uniq_bang(VALUE ary)
|
||||||
if (RARRAY_LEN(ary) == (i = RHASH_SIZE(hash))) {
|
if (RARRAY_LEN(ary) == (i = RHASH_SIZE(hash))) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
ary_resize_capa(ary, i);
|
|
||||||
ARY_SET_LEN(ary, 0);
|
ARY_SET_LEN(ary, 0);
|
||||||
|
if (ARY_SHARED_P(ary) && !ARY_EMBED_P(ary)) {
|
||||||
|
rb_ary_unshare(ary);
|
||||||
|
}
|
||||||
|
ary_resize_capa(ary, i);
|
||||||
st_foreach(RHASH_TBL(hash), push_value, ary);
|
st_foreach(RHASH_TBL(hash), push_value, ary);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue