[前][次][番号順一覧][スレッド一覧]

ruby-changes:51570

From: nobu <ko1@a...>
Date: Fri, 29 Jun 2018 09:46:32 +0900 (JST)
Subject: [ruby-changes:51570] nobu:r63779 (trunk): rb_enc_alias

nobu	2018-06-28 22:18:52 +0900 (Thu, 28 Jun 2018)

  New Revision: 63779

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63779

  Log:
    rb_enc_alias
    
    `rb_encdb`-prefixed functions are only for internal use.
    use rb_enc_alias instead.

  Modified files:
    trunk/spec/ruby/optional/capi/encoding_spec.rb
    trunk/spec/ruby/optional/capi/ext/encoding_spec.c
    trunk/spec/ruby/optional/capi/ext/rubyspec.h
Index: spec/ruby/optional/capi/ext/rubyspec.h
===================================================================
--- spec/ruby/optional/capi/ext/rubyspec.h	(revision 63778)
+++ spec/ruby/optional/capi/ext/rubyspec.h	(revision 63779)
@@ -204,7 +204,7 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/rubyspec.h#L204
 #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
Index: spec/ruby/optional/capi/ext/encoding_spec.c
===================================================================
--- spec/ruby/optional/capi/ext/encoding_spec.c	(revision 63778)
+++ spec/ruby/optional/capi/ext/encoding_spec.c	(revision 63779)
@@ -93,12 +93,9 @@ static VALUE encoding_spec_rb_default_ex https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/encoding_spec.c#L93
 }
 #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);
-
-static VALUE encoding_spec_rb_encdb_alias(VALUE self, VALUE alias, VALUE orig) {
-  return INT2NUM(rb_encdb_alias(RSTRING_PTR(alias), RSTRING_PTR(orig)));
+#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)));
 }
 #endif
 
@@ -326,8 +323,8 @@ void Init_encoding_spec(void) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/encoding_spec.c#L323
                    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
Index: spec/ruby/optional/capi/encoding_spec.rb
===================================================================
--- spec/ruby/optional/capi/encoding_spec.rb	(revision 63778)
+++ spec/ruby/optional/capi/encoding_spec.rb	(revision 63779)
@@ -37,9 +37,9 @@ describe "C-API Encoding function" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/encoding_spec.rb#L37
     @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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]