diff --git a/time.c b/time.c index a6eed9b051aaaf..93b0fbdb64e8e9 100644 --- a/time.c +++ b/time.c @@ -336,6 +336,8 @@ v2w(VALUE v) return WIDEVAL_WRAP(v); } +#define NUM2WV(v) v2w(rb_Integer(v)) + static int weq(wideval_t wx, wideval_t wy) { @@ -2278,7 +2280,7 @@ extract_time(VALUE time) const ID id_to_i = idTo_i; #define EXTRACT_TIME() do { \ - t = v2w(rb_Integer(AREF(to_i))); \ + t = NUM2WV(AREF(to_i)); \ } while (0) if (rb_typeddata_is_kind_of(time, &time_data_type)) { @@ -2321,7 +2323,7 @@ extract_vtm(VALUE time, VALUE orig_time, struct time_object *orig_tobj, VALUE su vtm->sec = obj2subsecx(AREF(sec), &subsecx); \ vtm->isdst = RTEST(AREF(isdst)); \ vtm->utc_offset = Qnil; \ - t = v2w(rb_Integer(AREF(to_i))); \ + t = NUM2WV(AREF(to_i)); \ } while (0) if (rb_typeddata_is_kind_of(time, &time_data_type)) {