summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-29 23:57:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-29 23:57:25 +0000
commit4f66fb14427eb6d1b9ae1b8be3b03e648841e8fb (patch)
tree6e6990293c250f9951373495ba707d0cc69c1a2f /rational.c
parent725188d8dcdcf14709b68bff89fbc1a01dd421df (diff)
downloadruby-4f66fb14427eb6d1b9ae1b8be3b03e648841e8fb.tar.gz
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
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/rational.c b/rational.c
index 93a53775db..d5942f1add 100644
--- a/rational.c
+++ b/rational.c
@@ -24,10 +24,12 @@
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)
fun1(abs)
fun1(floor)
-fun1(inspect)
fun1(integer_p)
fun1(negate)
@@ -153,7 +154,6 @@ f_to_f(VALUE x)
return rb_funcall(x, id_to_f, 0);
}
-fun1(to_s)
fun1(truncate)
inline static VALUE
@@ -2450,12 +2450,10 @@ Init_Rational(void)
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");