1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c (rb_ary_sort_bang): freeze temporary array.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-05-08 06:14:36 +00:00
parent 6aa73e6cab
commit 265e855ca7
2 changed files with 7 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Thu May 8 15:14:34 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* array.c (rb_ary_sort_bang): freeze temporary array.
Thu May 8 13:19:18 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm.c (rb_thread_mark): mark stat_insn_usage only when ptr is not

View file

@ -1513,13 +1513,16 @@ rb_ary_sort_bang(VALUE ary)
RBASIC(tmp)->klass = 0;
ruby_qsort(RARRAY_PTR(tmp), RARRAY_LEN(tmp), sizeof(VALUE),
rb_block_given_p()?sort_1:sort_2, &RBASIC(tmp)->klass);
sort_reentered(&RBASIC(tmp)->klass);
RARRAY(ary)->ptr = RARRAY(tmp)->ptr;
RARRAY(ary)->len = RARRAY(tmp)->len;
RARRAY(ary)->aux.capa = RARRAY(tmp)->aux.capa;
FL_UNSET(ary, ELTS_SHARED);
RARRAY(tmp)->ptr = 0;
RARRAY(tmp)->len = 0;
RARRAY(tmp)->aux.capa = 0;
RBASIC(tmp)->klass = RBASIC(ary)->klass;
OBJ_FREEZE(tmp);
}
return ary;
}