summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-17 11:55:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-17 11:55:50 +0000
commit44c5c2a3120439af7560f9694dcb117953ee3119 (patch)
tree01373760110357e230e5aa20914bbf8479b5db4f /string.c
parentc9283b5c5dd1253bbfa340b34e40dcd57da377db (diff)
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.c7
1 files changed, 1 insertions, 6 deletions
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 {