summaryrefslogtreecommitdiff
path: root/array.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 /array.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 'array.c')
-rw-r--r--array.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/array.c b/array.c
index 8caad66a3e..82013df69d 100644
--- a/array.c
+++ b/array.c
@@ -2016,7 +2016,7 @@ enum {
sort_optimizable_count
};
-#define STRING_P(s) (TYPE(s) == T_STRING && CLASS_OF(s) == rb_cString)
+#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
#define SORT_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(sort_opt_,type))
#define SORT_OPTIMIZABLE(data, type) \
@@ -3137,7 +3137,7 @@ rb_ary_rassoc(VALUE ary, VALUE value)
for (i = 0; i < RARRAY_LEN(ary); ++i) {
v = RARRAY_PTR(ary)[i];
- if (TYPE(v) == T_ARRAY &&
+ if (RB_TYPE_P(v, T_ARRAY) &&
RARRAY_LEN(v) > 1 &&
rb_equal(RARRAY_PTR(v)[1], value))
return v;
@@ -3176,7 +3176,7 @@ static VALUE
rb_ary_equal(VALUE ary1, VALUE ary2)
{
if (ary1 == ary2) return Qtrue;
- if (TYPE(ary2) != T_ARRAY) {
+ if (!RB_TYPE_P(ary2, T_ARRAY)) {
if (!rb_respond_to(ary2, rb_intern("to_ary"))) {
return Qfalse;
}
@@ -3211,7 +3211,7 @@ static VALUE
rb_ary_eql(VALUE ary1, VALUE ary2)
{
if (ary1 == ary2) return Qtrue;
- if (TYPE(ary2) != T_ARRAY) return Qfalse;
+ if (!RB_TYPE_P(ary2, T_ARRAY)) return Qfalse;
if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return Qfalse;
return rb_exec_recursive_paired(recursive_eql, ary1, ary2, ary2);
}