summaryrefslogtreecommitdiff
path: root/range.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 /range.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 'range.c')
-rw-r--r--range.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/range.c b/range.c
index b7ae19118e..fb9ecd05b2 100644
--- a/range.c
+++ b/range.c
@@ -865,10 +865,10 @@ range_include(VALUE range, VALUE val)
}
return Qfalse;
}
- else if (TYPE(beg) == T_STRING && TYPE(end) == T_STRING &&
+ else if (RB_TYPE_P(beg, T_STRING) && RB_TYPE_P(end, T_STRING) &&
RSTRING_LEN(beg) == 1 && RSTRING_LEN(end) == 1) {
if (NIL_P(val)) return Qfalse;
- if (TYPE(val) == T_STRING) {
+ if (RB_TYPE_P(val, T_STRING)) {
if (RSTRING_LEN(val) == 0 || RSTRING_LEN(val) > 1)
return Qfalse;
else {
@@ -939,7 +939,7 @@ range_dumper(VALUE range)
static VALUE
range_loader(VALUE range, VALUE obj)
{
- if (TYPE(obj) != T_OBJECT || RBASIC(obj)->klass != rb_cObject) {
+ if (!RB_TYPE_P(obj, T_OBJECT) || RBASIC(obj)->klass != rb_cObject) {
rb_raise(rb_eTypeError, "not a dumped range object");
}