diff options
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/encoding.c b/encoding.c index 3b9b7905c5..8f2e65a491 100644 --- a/encoding.c +++ b/encoding.c @@ -24,6 +24,7 @@ #pragma GCC visibility push(default) int rb_enc_register(const char *name, rb_encoding *encoding); void rb_enc_set_base(const char *name, const char *orig); +int rb_enc_set_dummy(int index); void rb_encdb_declare(const char *name); int rb_encdb_replicate(const char *name, const char *orig); int rb_encdb_dummy(const char *name); @@ -362,6 +363,18 @@ rb_enc_set_base(const char *name, const char *orig) set_base_encoding(idx, rb_enc_from_index(origidx)); } +/* for encdb.h + * Set encoding dummy. + */ +int +rb_enc_set_dummy(int index) +{ + rb_encoding *enc = enc_table.list[index].enc; + + ENC_SET_DUMMY(enc); + return index; +} + int rb_enc_replicate(const char *name, rb_encoding *encoding) { @@ -647,8 +660,9 @@ enc_autoload(rb_encoding *enc) if (enc_autoload_p(base)) { if (enc_autoload(base) < 0) return -1; } - i = ENC_TO_ENCINDEX(enc); - enc_register_at(i, rb_enc_name(enc), base); + i = enc->ruby_encoding_index; + enc_register_at(i & ENC_INDEX_MASK, rb_enc_name(enc), base); + enc->ruby_encoding_index = i; } else { i = load_encoding(rb_enc_name(enc)); |