ruby-changes:8389
From: keiju <ko1@a...>
Date: Fri, 24 Oct 2008 21:21:18 +0900 (JST)
Subject: [ruby-changes:8389] Ruby:r19920 (trunk): * ext/mathn/rational.c: change several global functions.
keiju 2008-10-24 21:20:58 +0900 (Fri, 24 Oct 2008) New Revision: 19920 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19920 Log: * ext/mathn/rational.c: change several global functions. Modified files: trunk/ChangeLog trunk/ext/mathn/rational/rational.c Index: ChangeLog =================================================================== --- ChangeLog (revision 19919) +++ ChangeLog (revision 19920) @@ -1,3 +1,7 @@ +Fri Oct 24 21:19:45 2008 Keiju Ishitsuka <keiju@r...> + + * ext/mathn/rational.c: change several global functions. + Fri Oct 24 21:05:38 2008 Takeyuki FUJIOKA <xibbar@r...> * lib/cgi/html.rb: allow symbolized key. Index: ext/mathn/rational/rational.c =================================================================== --- ext/mathn/rational/rational.c (revision 19919) +++ ext/mathn/rational/rational.c (revision 19920) @@ -1151,7 +1151,7 @@ /* --- */ -#ifndef EXT_MATHN +#ifdef EXT_MATHN static #endif VALUE @@ -1161,7 +1161,7 @@ return f_gcd(self, other); } -#ifndef EXT_MATHN +#ifdef EXT_MATHN static #endif VALUE @@ -1171,7 +1171,7 @@ return f_lcm(self, other); } -#ifndef EXT_MATHN +#ifdef EXT_MATHN static #endif VALUE @@ -1181,29 +1181,35 @@ 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 -#ifndef EXT_MATHN +#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) + 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,7 +1218,9 @@ a[1] = y; return nurat_s_convert(2, a, rb_cRational); } +#endif + static VALUE nilclass_to_r(VALUE self) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/