From 0eef05cc00923e5352c35a05b8e1f586147717a9 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 31 Aug 2023 21:18:24 +0900 Subject: [PATCH] array.c (mrb_ary_to_s): use direct array access --- src/array.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/array.c b/src/array.c index a6a41e809..67b12ca31 100644 --- a/src/array.c +++ b/src/array.c @@ -1345,10 +1345,9 @@ mrb_ary_to_s(mrb_state *mrb, mrb_value self) mrb_str_cat_lit(mrb, ret, "...]"); return ret; } - mrb_int len = RARRAY_LEN(self); - for (mrb_int i=0; i0) mrb_str_cat_lit(mrb, ret, ", "); - mrb_str_cat_str(mrb, ret, mrb_inspect(mrb, mrb_ary_ref(mrb, self, i))); + mrb_str_cat_str(mrb, ret, mrb_inspect(mrb, RARRAY_PTR(self)[i])); mrb_gc_arena_restore(mrb, ai); } mrb_str_cat_lit(mrb, ret, "]");