diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-17 16:37:41 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-17 16:37:41 +0000 |
commit | e56d2c385aac51298b34edf3fe4fddde512aec1b (patch) | |
tree | 1fe3a1e04ba6de9c6e528f77cd4477c4ffe7c65e /ext/date | |
parent | fb8f7259c3435ac01ff9ac2718d325e7c309336b (diff) | |
download | ruby-e56d2c385aac51298b34edf3fe4fddde512aec1b.tar.gz |
* include/ruby/ruby.h: Hide Rational internal.
(RRational): Moved to internal.h
(RRATIONAL): Ditto.
(RRATIONAL_SET_NUM): Moved to rational.c.
(RRATIONAL_SET_DEN): Ditto.
* rational.c (rb_rational_num): New function.
(rb_rational_den): Ditto.
* include/ruby/intern.h (rb_rational_num): Declared.
(rb_rational_den): Ditto.
* ext/bigdecimal/bigdecimal.c: Follow the above change.
* ext/date/date_core.c: Ditto.
[ruby-core:60665] [Feature #9513]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date')
-rw-r--r-- | ext/date/date_core.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c index ee360b4afb..0775fecbf2 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -114,7 +114,7 @@ f_zero_p(VALUE x) return Qfalse; case T_RATIONAL: { - VALUE num = RRATIONAL(x)->num; + VALUE num = rb_rational_num(x); return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 0); } } @@ -305,9 +305,9 @@ inline static VALUE canon(VALUE x) { if (TYPE(x) == T_RATIONAL) { - VALUE den = RRATIONAL(x)->den; + VALUE den = rb_rational_den(x); if (FIXNUM_P(den) && FIX2LONG(den) == 1) - return RRATIONAL(x)->num; + return rb_rational_num(x); } return x; } @@ -2373,8 +2373,8 @@ offset_to_sec(VALUE vof, int *rof) return 1; } #endif - vn = RRATIONAL(vs)->num; - vd = RRATIONAL(vs)->den; + vn = rb_rational_num(vs); + vd = rb_rational_den(vs); if (FIXNUM_P(vn) && FIXNUM_P(vd) && (FIX2LONG(vd) == 1)) n = FIX2LONG(vn); @@ -3097,7 +3097,7 @@ wholenum_p(VALUE x) break; case T_RATIONAL: { - VALUE den = RRATIONAL(x)->den; + VALUE den = rb_rational_den(x); return FIXNUM_P(den) && FIX2LONG(den) == 1; } break; @@ -5707,7 +5707,7 @@ d_lite_plus(VALUE self, VALUE other) int jd, df, s; if (wholenum_p(other)) - return d_lite_plus(self, RRATIONAL(other)->num); + return d_lite_plus(self, rb_rational_num(other)); if (f_positive_p(other)) s = +1; |