ruby-changes:68311
From: Nobuyoshi <ko1@a...>
Date: Fri, 8 Oct 2021 11:10:39 +0900 (JST)
Subject: [ruby-changes:68311] d0268c5ec2 (master): Collect symbols instead of strings and get rid of rb_str_intern
https://git.ruby-lang.org/ruby.git/commit/?id=d0268c5ec2 From d0268c5ec20784cf5ed42caf43b076846ae6255a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 7 Oct 2021 20:11:48 +0900 Subject: 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L985 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) https://github.com/ruby/ruby/blob/trunk/vm.c#L1007 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; j<src_env->iseq->body->local_table_size; j++) { if (id == src_env->iseq->body->local_table[j]) { -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/