ruby-changes:28934
From: nobu <ko1@a...>
Date: Thu, 30 May 2013 08:57:36 +0900 (JST)
Subject: [ruby-changes:28934] nobu:r40986 (trunk): rational.c: use existing functions
nobu 2013-05-30 08:57:25 +0900 (Thu, 30 May 2013) New Revision: 40986 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40986 Log: rational.c: use existing functions * rational.c (f_inspect, f_to_s): use existing functions, rb_inspect and rb_obj_as_string respectively. Modified files: trunk/rational.c Index: rational.c =================================================================== --- rational.c (revision 40985) +++ rational.c (revision 40986) @@ -24,10 +24,12 @@ https://github.com/ruby/ruby/blob/trunk/rational.c#L24 VALUE rb_cRational; static ID id_abs, id_cmp, id_convert, id_eqeq_p, id_expt, id_fdiv, - id_floor, id_idiv, id_inspect, id_integer_p, id_negate, id_to_f, - id_to_i, id_to_s, id_truncate, id_i_num, id_i_den; + id_floor, id_idiv, id_integer_p, id_negate, id_to_f, + id_to_i, id_truncate, id_i_num, id_i_den; #define f_boolcast(x) ((x) ? Qtrue : Qfalse) +#define f_inspect rb_inspect +#define f_to_s rb_obj_as_string #define binop(n,op) \ inline static VALUE \ @@ -134,7 +136,6 @@ f_sub(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/rational.c#L136 fun1(abs) fun1(floor) -fun1(inspect) fun1(integer_p) fun1(negate) @@ -153,7 +154,6 @@ f_to_f(VALUE x) https://github.com/ruby/ruby/blob/trunk/rational.c#L154 return rb_funcall(x, id_to_f, 0); } -fun1(to_s) fun1(truncate) inline static VALUE @@ -2450,12 +2450,10 @@ Init_Rational(void) https://github.com/ruby/ruby/blob/trunk/rational.c#L2450 id_fdiv = rb_intern("fdiv"); id_floor = rb_intern("floor"); id_idiv = rb_intern("div"); - id_inspect = rb_intern("inspect"); id_integer_p = rb_intern("integer?"); id_negate = rb_intern("-@"); id_to_f = rb_intern("to_f"); id_to_i = rb_intern("to_i"); - id_to_s = rb_intern("to_s"); id_truncate = rb_intern("truncate"); id_i_num = rb_intern("@numerator"); id_i_den = rb_intern("@denominator"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/