summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-29 18:00:02 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-29 18:00:02 +0000
commitd3edfdc7d9cadd6c8e7f7b7c93729da5c5cf4542 (patch)
tree888e3a88f6d9ddb746ddebff0f42e7bd1041e630 /gc.c
parentd36ab02b9589ba7b95656719f81a5292d259d4fb (diff)
use RARRAY_AREF() instead of RARRAY_CONST_PTR().
* class.c (rb_keyword_error_new): use RARRAY_AREF() because RARRAY_CONST_PTR() can introduce additional overhead in a futre. Same fixes for other files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gc.c b/gc.c
index c3c4f4ea57..fb2d4a40d6 100644
--- a/gc.c
+++ b/gc.c
@@ -2797,13 +2797,13 @@ define_final0(VALUE obj, VALUE block)
/* avoid duplicate block, table is usually small */
{
- const VALUE *ptr = RARRAY_CONST_PTR(table);
long len = RARRAY_LEN(table);
long i;
- for (i = 0; i < len; i++, ptr++) {
- if (rb_funcall(*ptr, idEq, 1, block)) {
- return *ptr;
+ for (i = 0; i < len; i++) {
+ VALUE recv = RARRAY_AREF(table, i);
+ if (rb_funcall(recv, idEq, 1, block)) {
+ return recv;
}
}
}