summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-28 02:04:28 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-28 02:04:28 +0000
commit814fb8e6c7d88bdd5f88088f37893c6761bad7f3 (patch)
treefb4f56c061eee2a1b7ec79dc008afaa527ea497c
parent33335f28f49e88f021d65a0d15f1b315e20cb475 (diff)
* numeric.c: Create var for rb_intern("<=>")
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--numeric.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/numeric.c b/numeric.c
index 88fff399c7..7523f4ff37 100644
--- a/numeric.c
+++ b/numeric.c
@@ -109,7 +109,7 @@ static VALUE fix_uminus(VALUE num);
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)
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)
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)
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);