From 8ca2f6489bc2b04902472c544edd69664cef0c4e Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 17 Jan 2026 13:38:55 +0900 Subject: Revert "Fix rb_interned_str: create strings with BINARY (akak ASCII_8BIT) encoding" This reverts commit 1f3c52dc155fb7fbc42fc8e146924091ba1dfa20. --- ext/io/console/console.c | 8 ++++---- ext/io/console/extconf.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'ext') diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 2b0193bb90..7ddaf071a8 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -84,9 +84,9 @@ getattr(int fd, conmode *t) static ID id_getc, id_close; static ID id_gets, id_flush, id_chomp_bang; -#ifndef HAVE_RB_ENC_INTERNED_STR_CSTR +#ifndef HAVE_RB_INTERNED_STR_CSTR # define rb_str_to_interned_str(str) rb_str_freeze(str) -# define rb_enc_interned_str_cstr(str, enc) rb_str_freeze(rb_usascii_str_new_cstr(str)) +# define rb_interned_str_cstr(str) rb_str_freeze(rb_usascii_str_new_cstr(str)) #endif #if defined HAVE_RUBY_FIBER_SCHEDULER_H @@ -1897,7 +1897,7 @@ console_ttyname(VALUE io) size_t size = sizeof(termname); int e; if (ttyname_r(fd, tn, size) == 0) - return rb_enc_interned_str_cstr(tn, rb_usascii_encoding()); + return rb_interned_str_cstr(tn); if ((e = errno) == ERANGE) { VALUE s = rb_str_new(0, size); while (1) { @@ -1921,7 +1921,7 @@ console_ttyname(VALUE io) int e = errno; rb_syserr_fail_str(e, rb_sprintf("ttyname(%d)", fd)); } - return rb_enc_interned_str_cstr(tn, rb_usascii_encoding()); + return rb_interned_str_cstr(tn); } # else # error No ttyname function diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb index e6254c9e90..dd3d221ae5 100644 --- a/ext/io/console/extconf.rb +++ b/ext/io/console/extconf.rb @@ -9,7 +9,7 @@ have_func("rb_syserr_fail_str(0, Qnil)") or have_func("rb_syserr_new_str(0, Qnil)") or abort -have_func("rb_enc_interned_str_cstr") +have_func("rb_interned_str_cstr") have_func("rb_io_path", "ruby/io.h") have_func("rb_io_descriptor", "ruby/io.h") have_func("rb_io_get_write_io", "ruby/io.h") -- cgit v1.2.3