summaryrefslogtreecommitdiff
path: root/time.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 /time.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 'time.c')
-rw-r--r--time.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/time.c b/time.c
index 29565be..765dc31 100644
--- a/time.c
+++ b/time.c
@@ -3365,12 +3365,7 @@ time_cmp(VALUE time1, VALUE time2)
n = wcmp(tobj1->timew, tobj2->timew);
}
else {
- VALUE tmp;
-
- tmp = rb_funcall(time2, rb_intern("<=>"), 1, time1);
- if (NIL_P(tmp)) return Qnil;
-
- n = -rb_cmpint(tmp, time1, time2);
+ return rb_invcmp(time1, time2);
}
if (n == 0) return INT2FIX(0);
if (n > 0) return INT2FIX(1);