ruby-changes:33128
From: marcandre <ko1@a...>
Date: Fri, 28 Feb 2014 11:04:31 +0900 (JST)
Subject: [ruby-changes:33128] marcandRe: r45207 (trunk): * numeric.c: Create var for rb_intern("<=>")
marcandre 2014-02-28 11:04:28 +0900 (Fri, 28 Feb 2014) New Revision: 45207 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45207 Log: * numeric.c: Create var for rb_intern("<=>") Modified files: trunk/numeric.c Index: numeric.c =================================================================== --- numeric.c (revision 45206) +++ numeric.c (revision 45207) @@ -109,7 +109,7 @@ static VALUE fix_uminus(VALUE num); https://github.com/ruby/ruby/blob/trunk/numeric.c#L109 static VALUE fix_mul(VALUE x, VALUE y); static VALUE int_pow(long x, unsigned long y); -static ID id_coerce, id_to_i, id_eq, id_div; +static ID id_coerce, id_to_i, id_eq, id_div, id_cmp; VALUE rb_cNumeric; VALUE rb_cFloat; @@ -1170,7 +1170,7 @@ flo_cmp(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L1170 if (a > 0.0) return INT2FIX(1); return INT2FIX(-1); } - return rb_num_coerce_cmp(x, y, rb_intern("<=>")); + return rb_num_coerce_cmp(x, y, id_cmp); } return rb_dbl_cmp(a, b); } @@ -3138,7 +3138,7 @@ fix_cmp(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3138 return rb_integer_float_cmp(x, y); } else { - return rb_num_coerce_cmp(x, y, rb_intern("<=>")); + return rb_num_coerce_cmp(x, y, id_cmp); } } @@ -3838,6 +3838,7 @@ Init_Numeric(void) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3838 id_to_i = rb_intern("to_i"); id_eq = rb_intern("=="); id_div = rb_intern("div"); + id_cmp = rb_intern("<=>"); rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError); rb_eFloatDomainError = rb_define_class("FloatDomainError", rb_eRangeError); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/