diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-17 11:55:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-17 11:55:50 +0000 |
commit | 44c5c2a3120439af7560f9694dcb117953ee3119 (patch) | |
tree | 01373760110357e230e5aa20914bbf8479b5db4f /string.c | |
parent | c9283b5c5dd1253bbfa340b34e40dcd57da377db (diff) | |
download | ruby-44c5c2a3120439af7560f9694dcb117953ee3119.tar.gz |
compar.c: inversed comarison without infinite recursion
* 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/trunk@39292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -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 { |