mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rational.c: use existing functions
* rational.c (f_inspect, f_to_s): use existing functions, rb_inspect and rb_obj_as_string respectively. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
725188d8dc
commit
4f66fb1442
1 changed files with 4 additions and 6 deletions
10
rational.c
10
rational.c
|
@ -24,10 +24,12 @@
|
||||||
VALUE rb_cRational;
|
VALUE rb_cRational;
|
||||||
|
|
||||||
static ID id_abs, id_cmp, id_convert, id_eqeq_p, id_expt, id_fdiv,
|
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_floor, id_idiv, id_integer_p, id_negate, id_to_f,
|
||||||
id_to_i, id_to_s, id_truncate, id_i_num, id_i_den;
|
id_to_i, id_truncate, id_i_num, id_i_den;
|
||||||
|
|
||||||
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
|
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
|
||||||
|
#define f_inspect rb_inspect
|
||||||
|
#define f_to_s rb_obj_as_string
|
||||||
|
|
||||||
#define binop(n,op) \
|
#define binop(n,op) \
|
||||||
inline static VALUE \
|
inline static VALUE \
|
||||||
|
@ -134,7 +136,6 @@ f_sub(VALUE x, VALUE y)
|
||||||
|
|
||||||
fun1(abs)
|
fun1(abs)
|
||||||
fun1(floor)
|
fun1(floor)
|
||||||
fun1(inspect)
|
|
||||||
fun1(integer_p)
|
fun1(integer_p)
|
||||||
fun1(negate)
|
fun1(negate)
|
||||||
|
|
||||||
|
@ -153,7 +154,6 @@ f_to_f(VALUE x)
|
||||||
return rb_funcall(x, id_to_f, 0);
|
return rb_funcall(x, id_to_f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
fun1(to_s)
|
|
||||||
fun1(truncate)
|
fun1(truncate)
|
||||||
|
|
||||||
inline static VALUE
|
inline static VALUE
|
||||||
|
@ -2450,12 +2450,10 @@ Init_Rational(void)
|
||||||
id_fdiv = rb_intern("fdiv");
|
id_fdiv = rb_intern("fdiv");
|
||||||
id_floor = rb_intern("floor");
|
id_floor = rb_intern("floor");
|
||||||
id_idiv = rb_intern("div");
|
id_idiv = rb_intern("div");
|
||||||
id_inspect = rb_intern("inspect");
|
|
||||||
id_integer_p = rb_intern("integer?");
|
id_integer_p = rb_intern("integer?");
|
||||||
id_negate = rb_intern("-@");
|
id_negate = rb_intern("-@");
|
||||||
id_to_f = rb_intern("to_f");
|
id_to_f = rb_intern("to_f");
|
||||||
id_to_i = rb_intern("to_i");
|
id_to_i = rb_intern("to_i");
|
||||||
id_to_s = rb_intern("to_s");
|
|
||||||
id_truncate = rb_intern("truncate");
|
id_truncate = rb_intern("truncate");
|
||||||
id_i_num = rb_intern("@numerator");
|
id_i_num = rb_intern("@numerator");
|
||||||
id_i_den = rb_intern("@denominator");
|
id_i_den = rb_intern("@denominator");
|
||||||
|
|
Loading…
Reference in a new issue