ruby-changes:44672
From: mrkn <ko1@a...>
Date: Sat, 12 Nov 2016 16:32:32 +0900 (JST)
Subject: [ruby-changes:44672] mrkn:r56745 (trunk): rational.c: refactor by removing needless ID vars
mrkn 2016-11-12 16:32:28 +0900 (Sat, 12 Nov 2016) New Revision: 56745 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56745 Log: rational.c: refactor by removing needless ID vars * rational.c (id_cmp, id_trunate): removed. Modified files: trunk/rational.c Index: rational.c =================================================================== --- rational.c (revision 56744) +++ rational.c (revision 56745) @@ -33,9 +33,9 @@ https://github.com/ruby/ruby/blob/trunk/rational.c#L33 VALUE rb_cRational; -static ID id_abs, id_cmp, id_eqeq_p, id_expt, id_fdiv, +static ID id_abs, id_eqeq_p, id_expt, id_fdiv, id_idiv, id_integer_p, id_negate, - id_to_i, id_truncate, id_i_num, id_i_den; + id_to_i, id_i_num, id_i_den; #define f_boolcast(x) ((x) ? Qtrue : Qfalse) #define f_inspect rb_inspect @@ -1102,7 +1102,7 @@ nurat_cmp(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/rational.c#L1102 } } else { - return rb_num_coerce_cmp(self, other, id_cmp); + return rb_num_coerce_cmp(self, other, rb_intern("<=>")); } } @@ -2569,7 +2569,6 @@ Init_Rational(void) https://github.com/ruby/ruby/blob/trunk/rational.c#L2569 assert(fprintf(stderr, "assert() is now active\n")); id_abs = rb_intern("abs"); - id_cmp = rb_intern("<=>"); id_eqeq_p = rb_intern("=="); id_expt = rb_intern("**"); id_fdiv = rb_intern("fdiv"); @@ -2577,7 +2576,6 @@ Init_Rational(void) https://github.com/ruby/ruby/blob/trunk/rational.c#L2576 id_integer_p = rb_intern("integer?"); id_negate = rb_intern("-@"); id_to_i = rb_intern("to_i"); - 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/