diff options
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -2382,7 +2382,7 @@ rb_str_eql(VALUE str1, VALUE str2) static VALUE rb_str_cmp_m(VALUE str1, VALUE str2) { - long result; + int result; if (!RB_TYPE_P(str2, T_STRING)) { if (!rb_respond_to(str2, rb_intern("to_str"))) { @@ -2395,16 +2395,13 @@ rb_str_cmp_m(VALUE str1, VALUE str2) VALUE tmp = rb_funcall(str2, rb_intern("<=>"), 1, str1); if (NIL_P(tmp)) return Qnil; - if (!FIXNUM_P(tmp)) { - return rb_funcall(LONG2FIX(0), '-', 1, tmp); - } - result = -FIX2LONG(tmp); + result = -rb_cmpint(tmp, str1, str2); } } else { result = rb_str_cmp(str1, str2); } - return LONG2NUM(result); + return INT2FIX(result); } /* |