summaryrefslogtreecommitdiff
path: root/class.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 /class.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 'class.c')
-rw-r--r--class.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/class.c b/class.c
index b77974f..284cfa2 100644
--- a/class.c
+++ b/class.c
@@ -1776,14 +1776,13 @@ rb_define_attr(VALUE klass, const char *name, int read, int write)
MJIT_FUNC_EXPORTED VALUE
rb_keyword_error_new(const char *error, VALUE keys)
{
- const VALUE *ptr = RARRAY_CONST_PTR(keys);
long i = 0, len = RARRAY_LEN(keys);
VALUE error_message = rb_sprintf("%s keyword%.*s", error, len > 1, "s");
if (len > 0) {
rb_str_cat_cstr(error_message, ": ");
while (1) {
- const VALUE k = ptr[i];
+ const VALUE k = RARRAY_AREF(keys, i);
Check_Type(k, T_SYMBOL); /* wrong hash is given to rb_get_kwargs */
rb_str_append(error_message, rb_sym2str(k));
if (++i >= len) break;