Extract NUM2WV macro

This commit is contained in:
Nobuyoshi Nakada 2024-12-14 18:01:19 +09:00
parent 9f924e2f13
commit 70f5c62af1
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2024-12-14 10:27:50 +00:00

6
time.c
View File

@ -336,6 +336,8 @@ v2w(VALUE v)
return WIDEVAL_WRAP(v); return WIDEVAL_WRAP(v);
} }
#define NUM2WV(v) v2w(rb_Integer(v))
static int static int
weq(wideval_t wx, wideval_t wy) weq(wideval_t wx, wideval_t wy)
{ {
@ -2278,7 +2280,7 @@ extract_time(VALUE time)
const ID id_to_i = idTo_i; const ID id_to_i = idTo_i;
#define EXTRACT_TIME() do { \ #define EXTRACT_TIME() do { \
t = v2w(rb_Integer(AREF(to_i))); \ t = NUM2WV(AREF(to_i)); \
} while (0) } while (0)
if (rb_typeddata_is_kind_of(time, &time_data_type)) { 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->sec = obj2subsecx(AREF(sec), &subsecx); \
vtm->isdst = RTEST(AREF(isdst)); \ vtm->isdst = RTEST(AREF(isdst)); \
vtm->utc_offset = Qnil; \ vtm->utc_offset = Qnil; \
t = v2w(rb_Integer(AREF(to_i))); \ t = NUM2WV(AREF(to_i)); \
} while (0) } while (0)
if (rb_typeddata_is_kind_of(time, &time_data_type)) { if (rb_typeddata_is_kind_of(time, &time_data_type)) {