summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2025-10-16 09:59:47 -0400
committergit <svn-admin@ruby-lang.org>2025-10-16 14:00:28 +0000
commit6652d5072fa4888443d43db0a4026524b56925bf (patch)
treef63273bf8a781dbd08b463c7f53020677cc0aecd
parent99929d6f2b8433d5d2573054f08070e8a4c6bac3 (diff)
[ruby/prism] Create a new string for the current version error
https://github.com/ruby/prism/commit/ebf4425d49
-rw-r--r--prism/extension.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/prism/extension.c b/prism/extension.c
index 0c9d04225d..71c2d91b98 100644
--- a/prism/extension.c
+++ b/prism/extension.c
@@ -201,10 +201,9 @@ build_options_i(VALUE key, VALUE value, VALUE argument) {
const char *version = check_string(value);
if (RSTRING_LEN(value) == 7 && strncmp(version, "current", 7) == 0) {
- VALUE current_ruby_value = rb_const_get(rb_cObject, rb_intern("RUBY_VERSION"));
- const char *current_version = RSTRING_PTR(current_ruby_value);
+ const char *current_version = RSTRING_PTR(rb_const_get(rb_cObject, rb_intern("RUBY_VERSION")));
if (!pm_options_version_set(options, current_version, 3)) {
- rb_exc_raise(rb_exc_new_str(rb_cPrismCurrentVersionError, current_ruby_value));
+ rb_exc_raise(rb_exc_new_cstr(rb_cPrismCurrentVersionError, current_version));
}
} else if (!pm_options_version_set(options, version, RSTRING_LEN(value))) {
rb_raise(rb_eArgError, "invalid version: %" PRIsVALUE, value);