mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Remove Encoding#replicate
This commit is contained in:
parent
d831b1d5ce
commit
6abe20e87b
Notes:
git
2023-01-11 12:42:09 +00:00
8 changed files with 203 additions and 113 deletions
32
encoding.c
32
encoding.c
|
@ -505,37 +505,6 @@ enc_replicate(struct enc_table *enc_table, const char *name, rb_encoding *encodi
|
|||
return idx;
|
||||
}
|
||||
|
||||
int
|
||||
rb_enc_replicate(const char *name, rb_encoding *encoding)
|
||||
{
|
||||
int r;
|
||||
|
||||
GLOBAL_ENC_TABLE_EVAL(enc_table,
|
||||
r = enc_replicate(enc_table, name, encoding));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* enc.replicate(name) -> encoding
|
||||
*
|
||||
* Returns a replicated encoding of _enc_ whose name is _name_.
|
||||
* The new encoding should have the same byte structure of _enc_.
|
||||
* If _name_ is used by another encoding, raise ArgumentError.
|
||||
*
|
||||
*/
|
||||
static VALUE
|
||||
enc_replicate_m(VALUE encoding, VALUE name)
|
||||
{
|
||||
int idx;
|
||||
rb_warn_deprecated_to_remove("3.3", "Encoding#replicate", "the original encoding");
|
||||
|
||||
idx = rb_enc_replicate(name_for_encoding(&name), rb_to_encoding(encoding));
|
||||
RB_GC_GUARD(name);
|
||||
return rb_enc_from_encoding_index(idx);
|
||||
}
|
||||
|
||||
static int
|
||||
enc_replicate_with_index(struct enc_table *enc_table, const char *name, rb_encoding *origenc, int idx)
|
||||
{
|
||||
|
@ -1914,7 +1883,6 @@ Init_Encoding(void)
|
|||
rb_define_method(rb_cEncoding, "names", enc_names, 0);
|
||||
rb_define_method(rb_cEncoding, "dummy?", enc_dummy_p, 0);
|
||||
rb_define_method(rb_cEncoding, "ascii_compatible?", enc_ascii_compatible_p, 0);
|
||||
rb_define_method(rb_cEncoding, "replicate", enc_replicate_m, 1);
|
||||
rb_define_singleton_method(rb_cEncoding, "list", enc_list, 0);
|
||||
rb_define_singleton_method(rb_cEncoding, "name_list", rb_enc_name_list, 0);
|
||||
rb_define_singleton_method(rb_cEncoding, "aliases", rb_enc_aliases, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue