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

ruby-changes:8304

From: matz <ko1@a...>
Date: Sat, 18 Oct 2008 19:29:22 +0900 (JST)
Subject: [ruby-changes:8304] Ruby:r19832 (trunk): * re.c (rb_reg_initialize_m): specify ARG_ENCODING_NONE instead of

matz	2008-10-18 19:29:06 +0900 (Sat, 18 Oct 2008)

  New Revision: 19832

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

  Log:
    * re.c (rb_reg_initialize_m): specify ARG_ENCODING_NONE instead of
      ARG_ENCODING_FIXED for Regexp.new("", nil, "n").  [ruby-dev:36761]
    
    * test/ruby/test_regexp.rb (TestRegexp#test_initialize): test
      updated.

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

Index: re.c
===================================================================
--- re.c	(revision 19831)
+++ re.c	(revision 19832)
@@ -2795,7 +2795,7 @@
 	    char *kcode = StringValuePtr(argv[2]);
 	    if (kcode[0] == 'n' || kcode[1] == 'N') {
 		enc = rb_ascii8bit_encoding();
-		flags |= ARG_ENCODING_FIXED;
+		flags |= ARG_ENCODING_NONE;
 	    }
 	    else {
 		rb_warn("encoding option is ignored - %s", kcode);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19831)
+++ ChangeLog	(revision 19832)
@@ -27,6 +27,14 @@
 
 	* array.c: recycle shared-array when it isn't referenced.
 
+Fri Oct 17 20:29:26 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* re.c (rb_reg_initialize_m): specify ARG_ENCODING_NONE instead of
+	  ARG_ENCODING_FIXED for Regexp.new("", nil, "n").  [ruby-dev:36761]
+
+	* test/ruby/test_regexp.rb (TestRegexp#test_initialize): test
+	  updated.
+
 Fri Oct 17 19:46:20 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* tool/ifchange, win32/ifchange.bat: --timestamp option added.
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 19831)
+++ test/ruby/test_regexp.rb	(revision 19832)
@@ -272,8 +272,9 @@
       Thread.new { $SAFE = 4; re.instance_eval { initialize(re) } }.join
     end
 
-    assert_equal(Encoding.find("ASCII-8BIT"), Regexp.new("b..", nil, "n").encoding)
+    assert_equal(Encoding.find("US-ASCII"), Regexp.new("b..", nil, "n").encoding)
     assert_equal("bar", "foobarbaz"[Regexp.new("b..", nil, "n")])
+    assert_equal(//n, Regexp.new("", nil, "n"))
 
     assert_raise(RegexpError) { Regexp.new(")(") }
   end

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

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