@@ -201,16 +201,10 @@ build_options_i(VALUE key, VALUE value, VALUE argument) {
201201 const char * version = check_string (value );
202202
203203 if (RSTRING_LEN (value ) == 7 && strncmp (version , "current" , 7 ) == 0 ) {
204- VALUE ruby_version_string = rb_const_get (rb_cObject , rb_intern ("RUBY_VERSION" ));
205- const char * ruby_version = RSTRING_PTR (ruby_version_string );
206204 if (!pm_options_version_set (options , ruby_version , 3 )) {
207- rb_exc_raise (rb_exc_new_str (rb_cPrismCurrentVersionError , ruby_version_string ));
205+ rb_exc_raise (rb_exc_new_cstr (rb_cPrismCurrentVersionError , ruby_version ));
208206 }
209-
210- RB_GC_GUARD (ruby_version_string ); // Do not move ruby_version while running the code above
211207 } else if (RSTRING_LEN (value ) == 7 && strncmp (version , "nearest" , 7 ) == 0 ) {
212- VALUE ruby_version_string = rb_const_get (rb_cObject , rb_intern ("RUBY_VERSION" ));
213- const char * ruby_version = RSTRING_PTR (ruby_version_string );
214208 const char * nearest_version ;
215209
216210 if (ruby_version [0 ] < '3' || (ruby_version [0 ] == '3' && ruby_version [2 ] < '3' )) {
@@ -224,8 +218,6 @@ build_options_i(VALUE key, VALUE value, VALUE argument) {
224218 if (!pm_options_version_set (options , nearest_version , 3 )) {
225219 rb_raise (rb_eArgError , "invalid nearest version: %s" , nearest_version );
226220 }
227-
228- RB_GC_GUARD (ruby_version_string ); // Do not move ruby_version while running the code above
229221 } else if (!pm_options_version_set (options , version , RSTRING_LEN (value ))) {
230222 rb_raise (rb_eArgError , "invalid version: %" PRIsVALUE , value );
231223 }
0 commit comments