зеркало из https://github.com/github/ruby.git
* array.c (sort_2): comparison should be done as signed long.
* array.c (sort_2): should return int, not VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
ae23000c0e
Коммит
b818cdfaf3
|
@ -1,3 +1,9 @@
|
|||
Mon Aug 19 15:38:44 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (sort_2): comparison should be done as signed long.
|
||||
|
||||
* array.c (sort_2): should return int, not VALUE.
|
||||
|
||||
Mon Aug 19 12:38:33 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* eval.c (rb_thread_save_context, rb_thread_restore_context):
|
||||
|
|
8
array.c
8
array.c
|
@ -1089,12 +1089,12 @@ sort_2(ap, bp)
|
|||
VALUE *ap, *bp;
|
||||
{
|
||||
VALUE retval;
|
||||
VALUE a = *ap, b = *ap;
|
||||
long a = (long)*ap, b = (long)*ap;
|
||||
|
||||
if (FIXNUM_P(a) && FIXNUM_P(b)) {
|
||||
if (a > b) return INT2FIX(1);
|
||||
if (a < b) return INT2FIX(-1);
|
||||
return INT2FIX(0);
|
||||
if (a > b) return 1;
|
||||
if (a < b) return -1;
|
||||
return 0;
|
||||
}
|
||||
if (TYPE(a) == T_STRING && TYPE(b) == T_STRING) {
|
||||
return rb_str_cmp(a, b);
|
||||
|
|
Загрузка…
Ссылка в новой задаче