summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2022-09-03 12:46:57 +0200
committerBenoit Daloze <eregontp@gmail.com>2022-09-10 19:02:15 +0200
commit14bcf69c9c36875c7956d0ec8c04bfeaec514dd1 (patch)
treefd61c7b98e61ce27c2ee9421d5a6ea6d5278203b /encoding.c
parentf64117952534b71a11636837bddbfea7506ee785 (diff)
downloadruby-14bcf69c9c36875c7956d0ec8c04bfeaec514dd1.tar.gz
Deprecate Encoding#replicate
* See [Feature #18949].
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/encoding.c b/encoding.c
index b8fedfb797..5c4dfad3f0 100644
--- a/encoding.c
+++ b/encoding.c
@@ -17,6 +17,7 @@
#include "internal.h"
#include "internal/enc.h"
#include "internal/encoding.h"
+#include "internal/error.h"
#include "internal/inits.h"
#include "internal/load.h"
#include "internal/object.h"
@@ -569,7 +570,10 @@ rb_enc_replicate(const char *name, rb_encoding *encoding)
static VALUE
enc_replicate_m(VALUE encoding, VALUE name)
{
- int idx = rb_enc_replicate(name_for_encoding(&name), rb_to_encoding(encoding));
+ 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);
}