diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-28 09:04:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-28 09:04:51 +0000 |
commit | f510d9f3c471ffe037a2154968acd75264ae4ef6 (patch) | |
tree | 0530d7221d1d907fdb48ffbc17e53211ad89e619 /time.c | |
parent | 603363369b40e991801f36e82bdc21eab819cc58 (diff) |
* 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
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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); } |