diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-13 03:55:44 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-13 03:55:44 +0000 |
commit | b3ecbfaa01e7c75bfea9c895bb7476c58e998131 (patch) | |
tree | 1b23f1e6c0b8291136e64917835310a6cbde1fbc /enum.c | |
parent | a2020f907a942f09c651b1006151c932cdf7e77e (diff) |
* 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
Diffstat (limited to 'enum.c')
-rw-r--r-- | enum.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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]; |