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

ruby-changes:15812

From: naruse <ko1@a...>
Date: Wed, 12 May 2010 10:06:42 +0900 (JST)
Subject: [ruby-changes:15812] Ruby:r27743 (trunk): * re.c (rb_reg_initialize_m): fix wrong index for the lang

naruse	2010-05-12 10:06:24 +0900 (Wed, 12 May 2010)

  New Revision: 27743

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

  Log:
    * re.c (rb_reg_initialize_m): fix wrong index for the lang
      option's value 'N'. reported by Masaya TARUI via IRC.

  Modified files:
    trunk/ChangeLog
    trunk/re.c
    trunk/test/ruby/test_regexp.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27742)
+++ ChangeLog	(revision 27743)
@@ -1,3 +1,8 @@
+Wed May 12 09:21:05 2010  NARUSE, Yui  <naruse@r...>
+
+	* re.c (rb_reg_initialize_m): fix wrong index for the lang
+	  option's value 'N'. reported by Masaya TARUI via IRC.
+
 Tue May 11 23:07:22 2010  Tanaka Akira  <akr@f...>
 
 	* ext/socket/extconf.rb: test IPPROTO_IP and IPPROTO_IPV6 constants.
Index: re.c
===================================================================
--- re.c	(revision 27742)
+++ re.c	(revision 27743)
@@ -2894,7 +2894,7 @@
 	enc = 0;
 	if (argc == 3 && !NIL_P(argv[2])) {
 	    char *kcode = StringValuePtr(argv[2]);
-	    if (kcode[0] == 'n' || kcode[1] == 'N') {
+	    if (kcode[0] == 'n' || kcode[0] == 'N') {
 		enc = rb_ascii8bit_encoding();
 		flags |= ARG_ENCODING_NONE;
 	    }
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 27742)
+++ test/ruby/test_regexp.rb	(revision 27743)
@@ -286,6 +286,10 @@
     assert_equal("bar", "foobarbaz"[Regexp.new("b..", nil, "n")])
     assert_equal(//n, Regexp.new("", nil, "n"))
 
+    arg_encoding_none = 32 # ARG_ENCODING_NONE is implementation defined value
+    assert_equal(arg_encoding_none, Regexp.new("", nil, "n").options)
+    assert_equal(arg_encoding_none, Regexp.new("", nil, "N").options)
+
     assert_raise(RegexpError) { Regexp.new(")(") }
   end
 

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

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