From f510d9f3c471ffe037a2154968acd75264ae4ef6 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 28 Apr 2010 09:04:51 +0000 Subject: * time.c (time_timespec): use rb_check_funcall. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- time.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'time.c') diff --git a/time.c b/time.c index 6f01c5f985..4bfb2df955 100644 --- a/time.c +++ b/time.c @@ -2296,11 +2296,9 @@ time_timespec(VALUE num, int interval) break; default: - if (rb_respond_to(num, id_divmod)) { - ary = rb_check_array_type(rb_funcall(num, id_divmod, 1, INT2FIX(1))); - if (NIL_P(ary)) { - goto typeerror; - } + i = INT2FIX(1); + ary = rb_check_funcall(num, id_divmod, 1, &i); + if (ary != Qundef && !NIL_P(ary = rb_check_array_type(ary))) { i = rb_ary_entry(ary, 0); f = rb_ary_entry(ary, 1); t.tv_sec = NUM2TIMET(i); @@ -2310,7 +2308,6 @@ time_timespec(VALUE num, int interval) t.tv_nsec = NUM2LONG(f); } else { -typeerror: rb_raise(rb_eTypeError, "can't convert %s into %s", rb_obj_classname(num), tstr); } -- cgit v1.2.3