mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
Revert "Fix rb_interned_str: create strings with BINARY (akak ASCII_8BIT) encoding"
This reverts commit 1f3c52dc155fb7fbc42fc8e146924091ba1dfa20.
This commit is contained in:
parent
3e13b7d4ef
commit
8ca2f6489b
Notes:
git
2026-01-17 05:52:52 +00:00
@ -1367,7 +1367,7 @@ enc_names_i(st_data_t name, st_data_t idx, st_data_t args)
|
||||
VALUE *arg = (VALUE *)args;
|
||||
|
||||
if ((int)idx == (int)arg[0]) {
|
||||
VALUE str = rb_enc_interned_str_cstr((char *)name, rb_usascii_encoding());
|
||||
VALUE str = rb_interned_str_cstr((char *)name);
|
||||
rb_ary_push(arg[1], str);
|
||||
}
|
||||
return ST_CONTINUE;
|
||||
@ -1873,7 +1873,7 @@ static int
|
||||
rb_enc_name_list_i(st_data_t name, st_data_t idx, st_data_t arg)
|
||||
{
|
||||
VALUE ary = (VALUE)arg;
|
||||
VALUE str = rb_enc_interned_str_cstr((char *)name, rb_usascii_encoding());
|
||||
VALUE str = rb_interned_str_cstr((char *)name);
|
||||
rb_ary_push(ary, str);
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
@ -1921,7 +1921,7 @@ rb_enc_aliases_enc_i(st_data_t name, st_data_t orig, st_data_t arg)
|
||||
str = rb_fstring_cstr(rb_enc_name(enc));
|
||||
rb_ary_store(ary, idx, str);
|
||||
}
|
||||
key = rb_enc_interned_str_cstr((char *)name, rb_usascii_encoding());
|
||||
key = rb_interned_str_cstr((char *)name);
|
||||
rb_hash_aset(aliases, key, str);
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -9582,7 +9582,7 @@ rb_gc_impl_init(void)
|
||||
VALUE opts;
|
||||
/* \GC build options */
|
||||
rb_define_const(rb_mGC, "OPTS", opts = rb_ary_new());
|
||||
#define OPT(o) if (o) rb_ary_push(opts, rb_enc_interned_str(#o, sizeof(#o) - 1, rb_usascii_encoding()))
|
||||
#define OPT(o) if (o) rb_ary_push(opts, rb_interned_str(#o, sizeof(#o) - 1))
|
||||
OPT(GC_DEBUG);
|
||||
OPT(USE_RGENGC);
|
||||
OPT(RGENGC_DEBUG);
|
||||
|
||||
2
string.c
2
string.c
@ -12709,7 +12709,7 @@ VALUE
|
||||
rb_interned_str(const char *ptr, long len)
|
||||
{
|
||||
struct RString fake_str = {RBASIC_INIT};
|
||||
return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_ASCII_8BIT), true, false);
|
||||
return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII), true, false);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user