summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-29 11:07:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-29 11:07:45 +0000
commit8e6e8e628888aa251f771ce8b3fe30a6b41a7a0e (patch)
treee531ed455f2ffb110e9a16de2161b3865a19d582 /object.c
parent68f97d7851481e11ce90bb349345dc4caed00cf7 (diff)
* use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/object.c b/object.c
index 3a7265b31d..23c18edb33 100644
--- a/object.c
+++ b/object.c
@@ -432,7 +432,7 @@ inspect_obj(VALUE obj, VALUE str, int recur)
static VALUE
rb_obj_inspect(VALUE obj)
{
- if (TYPE(obj) == T_OBJECT && rb_obj_basic_to_s_p(obj)) {
+ if (RB_TYPE_P(obj, T_OBJECT) && rb_obj_basic_to_s_p(obj)) {
int has_ivar = 0;
VALUE *ptr = ROBJECT_IVPTR(obj);
long len = ROBJECT_NUMIV(obj);
@@ -1661,7 +1661,7 @@ rb_class_superclass(VALUE klass)
if (klass == rb_cBasicObject) return Qnil;
rb_raise(rb_eTypeError, "uninitialized class");
}
- while (TYPE(super) == T_ICLASS) {
+ while (RB_TYPE_P(super, T_ICLASS)) {
super = RCLASS_SUPER(super);
}
if (!super) {
@@ -2157,7 +2157,7 @@ rb_to_integer(VALUE val, const char *method)
VALUE v;
if (FIXNUM_P(val)) return val;
- if (TYPE(val) == T_BIGNUM) return val;
+ if (RB_TYPE_P(val, T_BIGNUM)) return val;
v = convert_type(val, "Integer", method, TRUE);
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
const char *cname = rb_obj_classname(val);
@@ -2173,7 +2173,7 @@ rb_check_to_integer(VALUE val, const char *method)
VALUE v;
if (FIXNUM_P(val)) return val;
- if (TYPE(val) == T_BIGNUM) return val;
+ if (RB_TYPE_P(val, T_BIGNUM)) return val;
v = convert_type(val, "Integer", method, FALSE);
if (!rb_obj_is_kind_of(v, rb_cInteger)) {
return Qnil;
@@ -2437,7 +2437,7 @@ rb_f_float(VALUE obj, VALUE arg)
VALUE
rb_to_float(VALUE val)
{
- if (TYPE(val) == T_FLOAT) return val;
+ if (RB_TYPE_P(val, T_FLOAT)) return val;
if (!rb_obj_is_kind_of(val, rb_cNumeric)) {
rb_raise(rb_eTypeError, "can't convert %s into Float",
NIL_P(val) ? "nil" :
@@ -2451,7 +2451,7 @@ rb_to_float(VALUE val)
VALUE
rb_check_to_float(VALUE val)
{
- if (TYPE(val) == T_FLOAT) return val;
+ if (RB_TYPE_P(val, T_FLOAT)) return val;
if (!rb_obj_is_kind_of(val, rb_cNumeric)) {
return Qnil;
}