Skip to content

Commit ebf4425

Browse files
committed
Create a new string for the current version error
1 parent 2466940 commit ebf4425

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

ext/prism/extension.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,9 @@ 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 current_ruby_value = rb_const_get(rb_cObject, rb_intern("RUBY_VERSION"));
205-
const char *current_version = RSTRING_PTR(current_ruby_value);
204+
const char *current_version = RSTRING_PTR(rb_const_get(rb_cObject, rb_intern("RUBY_VERSION")));
206205
if (!pm_options_version_set(options, current_version, 3)) {
207-
rb_exc_raise(rb_exc_new_str(rb_cPrismCurrentVersionError, current_ruby_value));
206+
rb_exc_raise(rb_exc_new_cstr(rb_cPrismCurrentVersionError, current_version));
208207
}
209208
} else if (!pm_options_version_set(options, version, RSTRING_LEN(value))) {
210209
rb_raise(rb_eArgError, "invalid version: %" PRIsVALUE, value);

0 commit comments

Comments
 (0)