From d0268c5ec20784cf5ed42caf43b076846ae6255a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 7 Oct 2021 20:11:48 +0900 Subject: [PATCH] Collect symbols instead of strings and get rid of rb_str_intern --- vm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vm.c b/vm.c index d5e984ce61..785bb0c5cb 100644 --- a/vm.c +++ b/vm.c @@ -985,11 +985,11 @@ collect_outer_variable_names(ID id, VALUE val, void *ptr) if (data->isolate || val == Qtrue /* write */) { if (data->ary == Qfalse) data->ary = rb_ary_new(); - rb_ary_push(data->ary, rb_id2str(id)); + rb_ary_push(data->ary, ID2SYM(id)); } else { if (data->read_only == Qfalse) data->read_only = rb_ary_new(); - rb_ary_push(data->read_only, rb_id2str(id)); + rb_ary_push(data->read_only, ID2SYM(id)); } } return ID_TABLE_CONTINUE; @@ -1007,7 +1007,7 @@ env_copy(const VALUE *src_ep, VALUE read_only_variables) if (read_only_variables) { for (int i=RARRAY_LENINT(read_only_variables)-1; i>=0; i--) { - ID id = SYM2ID(rb_str_intern(RARRAY_AREF(read_only_variables, i))); + ID id = SYM2ID(RARRAY_AREF(read_only_variables, i)); for (unsigned int j=0; jiseq->body->local_table_size; j++) { if (id == src_env->iseq->body->local_table[j]) {