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

ruby-changes:34959

From: nobu <ko1@a...>
Date: Sun, 3 Aug 2014 10:55:42 +0900 (JST)
Subject: [ruby-changes:34959] nobu:r47041 (trunk): transcode.c: use string

nobu	2014-08-03 10:55:32 +0900 (Sun, 03 Aug 2014)

  New Revision: 47041

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

  Log:
    transcode.c: use string
    
    * transcode.c (econv_opts): get rid of inadvertent ID creation,
      and preserve argument encoding in error messages.

  Modified files:
    trunk/test/ruby/test_econv.rb
    trunk/transcode.c
Index: test/ruby/test_econv.rb
===================================================================
--- test/ruby/test_econv.rb	(revision 47040)
+++ test/ruby/test_econv.rb	(revision 47041)
@@ -908,6 +908,9 @@ class TestEncodingConverter < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/ruby/test_econv.rb#L908
     ec1 = Encoding::Converter.new("", "", universal_newline: true)
     ec2 = Encoding::Converter.new("", "", newline: :universal)
     assert_equal(ec1, ec2)
+    assert_raise_with_message(ArgumentError, /\u{3042}/) {
+      Encoding::Converter.new("", "", newline: "\u{3042}".to_sym)
+    }
   end
 
   def test_default_external
Index: transcode.c
===================================================================
--- transcode.c	(revision 47040)
+++ transcode.c	(revision 47041)
@@ -2487,8 +2487,8 @@ econv_opts(VALUE opt, int ecflags) https://github.com/ruby/ruby/blob/trunk/transcode.c#L2487
 	    /* ecflags |= ECONV_LF_NEWLINE_DECORATOR; */
 	}
 	else if (SYMBOL_P(v)) {
-	    rb_raise(rb_eArgError, "unexpected value for newline option: %s",
-		     rb_id2name(SYM2ID(v)));
+	    rb_raise(rb_eArgError, "unexpected value for newline option: %"PRIsVALUE,
+		     rb_sym2str(v));
 	}
 	else {
 	    rb_raise(rb_eArgError, "unexpected value for newline option");

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

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