mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (svalue_to_avalue): v may be Qundef. This fix was
suggested by Guy Decoux. * hash.c (rb_hash_s_create): use rb_hash_aset() instead of calling st_insert() directly, to dup&freeze string keys. * parse.y (yylex): proper error message for "@@0". * parse.y (yylex): paren to parse_string() must be zero for unparenthesized strings. * parse.y (str_extend): broken string when unterminated "#{". * enum.c (enum_sort_by): had a bug in 1 element enumeration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a2020f907a
commit
b3ecbfaa01
5 changed files with 36 additions and 8 deletions
5
enum.c
5
enum.c
|
@ -280,8 +280,9 @@ enum_sort_by(obj)
|
|||
|
||||
ary = rb_ary_new2((TYPE(obj) == T_ARRAY) ? RARRAY(obj)->len : 2000);
|
||||
rb_iterate(rb_each, obj, sort_by_i, ary);
|
||||
if (RARRAY(ary)->len <= 1) return ary;
|
||||
qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE), sort_by_cmp);
|
||||
if (RARRAY(obj)->len > 1) {
|
||||
qsort(RARRAY(ary)->ptr, RARRAY(ary)->len, sizeof(VALUE), sort_by_cmp);
|
||||
}
|
||||
for (i=0; i<RARRAY(ary)->len; i++) {
|
||||
VALUE e = RARRAY(ary)->ptr[i];
|
||||
RARRAY(ary)->ptr[i] = RARRAY(e)->ptr[1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue