diff options
author | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-24 12:20:58 +0000 |
---|---|---|
committer | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-24 12:20:58 +0000 |
commit | f953305ff547aad84ddbbbc4279f444705b5e23f (patch) | |
tree | 499301ab50218bd7701b25eece33c6b165395a63 | |
parent | b1c14f8fbb15ddb1c44d169dee67bb32f903bfa9 (diff) |
* ext/mathn/rational.c: change several global functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ext/mathn/rational/rational.c | 30 |
2 files changed, 23 insertions, 11 deletions
@@ -1,3 +1,7 @@ +Fri Oct 24 21:19:45 2008 Keiju Ishitsuka <keiju@ruby-lang.org> + + * ext/mathn/rational.c: change several global functions. + Fri Oct 24 21:05:38 2008 Takeyuki FUJIOKA <xibbar@ruby-lang.org> * lib/cgi/html.rb: allow symbolized key. diff --git a/ext/mathn/rational/rational.c b/ext/mathn/rational/rational.c index b307380488..74b7e4999f 100644 --- a/ext/mathn/rational/rational.c +++ b/ext/mathn/rational/rational.c @@ -1151,7 +1151,7 @@ nurat_marshal_load(VALUE self, VALUE a) /* --- */ -#ifndef EXT_MATHN +#ifdef EXT_MATHN static #endif VALUE @@ -1161,7 +1161,7 @@ rb_gcd(VALUE self, VALUE other) return f_gcd(self, other); } -#ifndef EXT_MATHN +#ifdef EXT_MATHN static #endif VALUE @@ -1171,7 +1171,7 @@ rb_lcm(VALUE self, VALUE other) return f_lcm(self, other); } -#ifndef EXT_MATHN +#ifdef EXT_MATHN static #endif VALUE @@ -1181,29 +1181,35 @@ rb_gcdlcm(VALUE self, VALUE other) return rb_assoc_new(f_gcd(self, other), f_lcm(self, other)); } -#ifndef EXT_MATHN -static -#endif +#ifdef EXT_MATHN VALUE rb_rational_raw(VALUE x, VALUE y) { return nurat_s_new_internal(rb_cRational, x, y); } +#endif + +#ifdef EXT_MATHN + +#define rb_rational_new1(x) rb_rational_new_mathn(x, INT2FIX(1)) +#define rb_rational_new2(x,y) rb_rational_new_mathn(x, y) -#ifndef EXT_MATHN static -#endif +rb_rational_new_mathn(VALUE x, VALUE y) +{ + return nurat_s_canonicalize_internal(rb_cRational, x, y); +} +#else VALUE rb_rational_new(VALUE x, VALUE y) { return nurat_s_canonicalize_internal(rb_cRational, x, y); } +#endif static VALUE nurat_s_convert(int argc, VALUE *argv, VALUE klass); -#ifndef EXT_MATHN -static -#endif +#ifdef EXT_MATHN VALUE rb_Rational(VALUE x, VALUE y) { @@ -1212,6 +1218,8 @@ rb_Rational(VALUE x, VALUE y) a[1] = y; return nurat_s_convert(2, a, rb_cRational); } +#endif + static VALUE nilclass_to_r(VALUE self) |