summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-21 02:23:32 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-21 02:23:32 +0000
commite539565d9a69d9a355e747d016228926467348ab (patch)
treee36c93d5714302559ed1c2729a0979c7afcecd91 /array.c
parent8bb93fc8ae53a541be4aa0c3223f1e505b913386 (diff)
* array.c: use rb_equal_opt() for performance improvement.
[ruby-core:64954] [Feature #10227] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/array.c b/array.c
index 6b551db..4775472 100644
--- a/array.c
+++ b/array.c
@@ -3846,9 +3846,15 @@ VALUE
rb_ary_includes(VALUE ary, VALUE item)
{
long i;
+ VALUE e;
for (i=0; i<RARRAY_LEN(ary); i++) {
- if (rb_equal(RARRAY_AREF(ary, i), item)) {
+ e = RARRAY_AREF(ary, i);
+ switch (rb_equal_opt(e, item)) {
+ case Qundef:
+ if (rb_equal(e, item)) return Qtrue;
+ break;
+ case Qtrue:
return Qtrue;
}
}