1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Revert "rb_enc_alias"

This reverts commit r63779 which made test-spec fail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-06-28 14:18:56 +00:00
parent 7c9fa8f9bb
commit 4aaceb29bc
3 changed files with 11 additions and 8 deletions

View file

@ -37,9 +37,9 @@ describe "C-API Encoding function" do
@s = CApiEncodingSpecs.new
end
describe "rb_enc_alias" do
describe "rb_encdb_alias" do
it "creates an alias for an existing Encoding" do
@s.rb_enc_alias("ZOMGWTFBBQ", "UTF-8").should >= 0
@s.rb_encdb_alias("ZOMGWTFBBQ", "UTF-8").should >= 0
Encoding.find("ZOMGWTFBBQ").name.should == "UTF-8"
end
end

View file

@ -93,9 +93,12 @@ static VALUE encoding_spec_rb_default_external_encoding(VALUE self) {
}
#endif
#ifdef HAVE_RB_ENC_ALIAS
static VALUE encoding_spec_rb_enc_alias(VALUE self, VALUE alias, VALUE orig) {
return INT2NUM(rb_enc_alias(RSTRING_PTR(alias), RSTRING_PTR(orig)));
#ifdef HAVE_RB_ENCDB_ALIAS
/* Not exposed by MRI C-API encoding.h but used in the pg gem. */
extern int rb_encdb_alias(const char* alias, const char* orig);
static VALUE encoding_spec_rb_encdb_alias(VALUE self, VALUE alias, VALUE orig) {
return INT2NUM(rb_encdb_alias(RSTRING_PTR(alias), RSTRING_PTR(orig)));
}
#endif
@ -323,8 +326,8 @@ void Init_encoding_spec(void) {
encoding_spec_rb_default_external_encoding, 0);
#endif
#ifdef HAVE_RB_ENC_ALIAS
rb_define_method(cls, "rb_enc_alias", encoding_spec_rb_enc_alias, 2);
#ifdef HAVE_RB_ENCDB_ALIAS
rb_define_method(cls, "rb_encdb_alias", encoding_spec_rb_encdb_alias, 2);
#endif
#ifdef HAVE_RB_ENC_ASSOCIATE

View file

@ -204,7 +204,7 @@
#define HAVE_RB_DEFAULT_INTERNAL_ENCODING 1
#define HAVE_RB_DEFAULT_EXTERNAL_ENCODING 1
#define HAVE_RB_ENC_ALIAS 1
#define HAVE_RB_ENCDB_ALIAS 1
#define HAVE_RB_ENC_ASSOCIATE 1
#define HAVE_RB_ENC_ASSOCIATE_INDEX 1
#define HAVE_RB_ENC_CODEPOINT_LEN 1