@@ -171,18 +171,11 @@ static VALUE location_end_pos(VALUE self) {
171171static rbs_constant_id_t rbs_constant_pool_insert_ruby_symbol (VALUE symbol ) {
172172 VALUE name = rb_sym2str (symbol );
173173
174- if (RB_STATIC_SYM_P (symbol )) {
175- // Constants inserted here will never be freed, but that's acceptable because:
176- // 1. Most symbols passed into here will be the ones already inserted into the constant pool by `parser.c`.
177- // 2. Methods like `add_required_child` and `add_optional_child` will usually only get called with a few different symbols.
178- return rbs_constant_pool_insert_constant (RBS_GLOBAL_CONSTANT_POOL , (const uint8_t * ) RSTRING_PTR (name ), RSTRING_LEN (name ));
179- } else {
180- // To prevent memory compaction from breaking references to strings,
181- // strings are copied and memory managed with an owned type.
182- uint8_t * copied_name = malloc (RSTRING_LEN (name ));
183- memcpy ((void * ) copied_name , RSTRING_PTR (name ), RSTRING_LEN (name ));
184- return rbs_constant_pool_insert_owned (RBS_GLOBAL_CONSTANT_POOL , copied_name , RSTRING_LEN (name ));
185- }
174+ // To prevent memory compaction from breaking references to strings,
175+ // strings are copied and memory managed with an owned type.
176+ uint8_t * copied_name = malloc (RSTRING_LEN (name ));
177+ memcpy ((void * ) copied_name , RSTRING_PTR (name ), RSTRING_LEN (name ));
178+ return rbs_constant_pool_insert_owned (RBS_GLOBAL_CONSTANT_POOL , copied_name , RSTRING_LEN (name ));
186179}
187180
188181static VALUE location_add_required_child (VALUE self , VALUE name , VALUE start , VALUE end ) {
0 commit comments