diff --git a/array.c b/array.c index 1dd82ad28e..83a5ff41f5 100644 --- a/array.c +++ b/array.c @@ -5925,7 +5925,6 @@ static VALUE rb_ary_any_p(int argc, VALUE *argv, VALUE ary) { long i, len = RARRAY_LEN(ary); - const VALUE *ptr = RARRAY_CONST_PTR(ary); rb_check_arity(argc, 0, 1); if (!len) return Qfalse; @@ -5938,7 +5937,9 @@ rb_ary_any_p(int argc, VALUE *argv, VALUE ary) } } else if (!rb_block_given_p()) { - for (i = 0; i < len; ++i) if (RTEST(ptr[i])) return Qtrue; + for (i = 0; i < len; ++i) { + if (RTEST(RARRAY_AREF(ary, i))) return Qtrue; + } } else { for (i = 0; i < RARRAY_LEN(ary); ++i) { diff --git a/compile.c b/compile.c index e72e47ba3d..112dba00d8 100644 --- a/compile.c +++ b/compile.c @@ -7754,7 +7754,6 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table, for (i=0; imt; VALUE state, left = INT2FIX(1), seed = INT2FIX(0); - const VALUE *ary; unsigned long x; rb_check_copyable(obj, dump); Check_Type(dump, T_ARRAY); - ary = RARRAY_CONST_PTR(dump); switch (RARRAY_LEN(dump)) { case 3: - seed = ary[2]; + seed = RARRAY_AREF(dump, 2); case 2: - left = ary[1]; + left = RARRAY_AREF(dump, 1); case 1: - state = ary[0]; + state = RARRAY_AREF(dump, 0); break; default: rb_raise(rb_eArgError, "wrong dump data"); diff --git a/thread.c b/thread.c index cb05c2c40f..0b8446ac96 100644 --- a/thread.c +++ b/thread.c @@ -3091,9 +3091,9 @@ rb_thread_to_s(VALUE thread) if (!target_th->first_func && target_th->first_proc) { VALUE loc = rb_proc_location(target_th->first_proc); if (!NIL_P(loc)) { - const VALUE *ptr = RARRAY_CONST_PTR(loc); - rb_str_catf(str, "@%"PRIsVALUE":%"PRIsVALUE, ptr[0], ptr[1]); - rb_gc_force_recycle(loc); + rb_str_catf(str, "@%"PRIsVALUE":%"PRIsVALUE, + RARRAY_AREF(loc, 0), RARRAY_AREF(loc, 1)); + rb_gc_force_recycle(loc); } } rb_str_catf(str, " %s>", status); diff --git a/thread_pthread.c b/thread_pthread.c index 368dc0421c..648bf8f3d5 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1615,18 +1615,17 @@ native_set_thread_name(rb_thread_t *th) SET_CURRENT_THREAD_NAME(RSTRING_PTR(loc)); } else if (!NIL_P(loc = rb_proc_location(th->first_proc))) { - const VALUE *ptr = RARRAY_CONST_PTR(loc); /* [ String, Integer ] */ char *name, *p; char buf[16]; size_t len; int n; - name = RSTRING_PTR(ptr[0]); + name = RSTRING_PTR(RARRAY_AREF(loc, 0)); p = strrchr(name, '/'); /* show only the basename of the path. */ if (p && p[1]) name = p + 1; - n = snprintf(buf, sizeof(buf), "%s:%d", name, NUM2INT(ptr[1])); + n = snprintf(buf, sizeof(buf), "%s:%d", name, NUM2INT(RARRAY_AREF(loc, 1))); rb_gc_force_recycle(loc); /* acts as a GC guard, too */ len = (size_t)n;