From 0558cc52725888379bf7ba1c81f37a31921df081 Mon Sep 17 00:00:00 2001 From: drbrain Date: Tue, 19 Feb 2013 23:57:11 +0000 Subject: Merge revision 39292: * compar.c (rb_invcmp): compare by inversed comarison, with preventing from infinite recursion. [ruby-core:52305] [Bug #7870] * string.c (rb_str_cmp_m), time.c (time_cmp): get rid of infinite recursion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 017617aaf1..3d4fd37b5a 100644 --- a/string.c +++ b/string.c @@ -2389,13 +2389,8 @@ rb_str_cmp_m(VALUE str1, VALUE str2) if (RB_TYPE_P(tmp, T_STRING)) { result = rb_str_cmp(str1, tmp); } - else if ((tmp = rb_check_funcall(str2, rb_intern("<=>"), 1, &str1)) == - Qundef) { - return Qnil; - } else { - if (NIL_P(tmp)) return Qnil; - result = -rb_cmpint(tmp, str1, str2); + return rb_invcmp(str1, str2); } } else { -- cgit v1.2.3