diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-28 23:46:59 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-28 23:46:59 +0000 |
commit | c69b33c46853369fdc391dd560ff3b4540cc3e0c (patch) | |
tree | 224690f80e4f2283829f94da7414e65b993ee3c9 | |
parent | 63e72a5850e2789920da6bc43169d74ccb0fa66c (diff) | |
download | ruby-c69b33c46853369fdc391dd560ff3b4540cc3e0c.tar.gz |
rb_enc_alias
`rb_encdb`-prefixed functions are only for internal use.
use rb_enc_alias instead.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | include/ruby/encoding.h | 1 | ||||
-rw-r--r-- | spec/ruby/optional/capi/encoding_spec.rb | 4 | ||||
-rw-r--r-- | spec/ruby/optional/capi/ext/encoding_spec.c | 13 | ||||
-rw-r--r-- | spec/ruby/optional/capi/ext/rubyspec.h | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 32d874aa9d..93939ee7db 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -124,6 +124,7 @@ int rb_enc_get_index(VALUE obj); void rb_enc_set_index(VALUE obj, int encindex); int rb_enc_capable(VALUE obj); int rb_enc_find_index(const char *name); +int rb_enc_alias(const char *alias, const char *orig); int rb_to_encoding_index(VALUE); rb_encoding *rb_to_encoding(VALUE); rb_encoding *rb_find_encoding(VALUE); diff --git a/spec/ruby/optional/capi/encoding_spec.rb b/spec/ruby/optional/capi/encoding_spec.rb index cd3f00d478..dc1019e8ae 100644 --- a/spec/ruby/optional/capi/encoding_spec.rb +++ b/spec/ruby/optional/capi/encoding_spec.rb @@ -37,9 +37,9 @@ describe "C-API Encoding function" do @s = CApiEncodingSpecs.new end - describe "rb_encdb_alias" do + describe "rb_enc_alias" do it "creates an alias for an existing Encoding" do - @s.rb_encdb_alias("ZOMGWTFBBQ", "UTF-8").should >= 0 + @s.rb_enc_alias("ZOMGWTFBBQ", "UTF-8").should >= 0 Encoding.find("ZOMGWTFBBQ").name.should == "UTF-8" end end diff --git a/spec/ruby/optional/capi/ext/encoding_spec.c b/spec/ruby/optional/capi/ext/encoding_spec.c index 6f4057865b..87b97f3a1b 100644 --- a/spec/ruby/optional/capi/ext/encoding_spec.c +++ b/spec/ruby/optional/capi/ext/encoding_spec.c @@ -93,12 +93,11 @@ static VALUE encoding_spec_rb_default_external_encoding(VALUE self) { } #endif -#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); +#ifdef HAVE_RB_ENC_ALIAS +extern int rb_enc_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))); +static VALUE encoding_spec_rb_enc_alias(VALUE self, VALUE alias, VALUE orig) { + return INT2NUM(rb_enc_alias(RSTRING_PTR(alias), RSTRING_PTR(orig))); } #endif @@ -326,8 +325,8 @@ void Init_encoding_spec(void) { encoding_spec_rb_default_external_encoding, 0); #endif -#ifdef HAVE_RB_ENCDB_ALIAS - rb_define_method(cls, "rb_encdb_alias", encoding_spec_rb_encdb_alias, 2); +#ifdef HAVE_RB_ENC_ALIAS + rb_define_method(cls, "rb_enc_alias", encoding_spec_rb_enc_alias, 2); #endif #ifdef HAVE_RB_ENC_ASSOCIATE diff --git a/spec/ruby/optional/capi/ext/rubyspec.h b/spec/ruby/optional/capi/ext/rubyspec.h index 4f50450dfb..1ece9541c7 100644 --- a/spec/ruby/optional/capi/ext/rubyspec.h +++ b/spec/ruby/optional/capi/ext/rubyspec.h @@ -204,7 +204,7 @@ #define HAVE_RB_DEFAULT_INTERNAL_ENCODING 1 #define HAVE_RB_DEFAULT_EXTERNAL_ENCODING 1 -#define HAVE_RB_ENCDB_ALIAS 1 +#define HAVE_RB_ENC_ALIAS 1 #define HAVE_RB_ENC_ASSOCIATE 1 #define HAVE_RB_ENC_ASSOCIATE_INDEX 1 #define HAVE_RB_ENC_CODEPOINT_LEN 1 |