Skip to content

Commit

Permalink
Extract NUM2WV macro
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Dec 14, 2024
1 parent 9f924e2 commit 70f5c62
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit 70f5c62

Please sign in to comment.