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

ruby-changes:9532

From: yugui <ko1@a...>
Date: Fri, 26 Dec 2008 20:17:01 +0900 (JST)
Subject: [ruby-changes:9532] Ruby:r21072 (ruby_1_9_1): merges r20952 from trunk into ruby_1_9_1.

yugui	2008-12-26 20:16:35 +0900 (Fri, 26 Dec 2008)

  New Revision: 21072

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

  Log:
    merges r20952 from trunk into ruby_1_9_1.
    * string.c (rb_external_str_new_with_enc): set ASCII-8BIT if
      encoding is US-ASCII and string contains 8bit characters.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/parse.y
    branches/ruby_1_9_1/string.c

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 21071)
+++ ruby_1_9_1/ChangeLog	(revision 21072)
@@ -340,6 +340,11 @@
 
 	* ext/tk/tcltklib.c: fix wrong flag value.
 
+Mon Dec 22 14:35:59 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* string.c (rb_external_str_new_with_enc): set ASCII-8BIT if
+	  encoding is US-ASCII and string contains 8bit characters.
+
 Mon Dec 22 12:26:18 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* cygwin/GNUmakefile.in (rubydll.def), win32/mkexports.rb
Index: ruby_1_9_1/string.c
===================================================================
--- ruby_1_9_1/string.c	(revision 21071)
+++ ruby_1_9_1/string.c	(revision 21072)
@@ -538,6 +538,11 @@
     VALUE str;
 
     str = rb_tainted_str_new(ptr, len);
+    if (rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT &&
+	eenc == rb_usascii_encoding()) {
+	rb_enc_associate(str, rb_ascii8bit_encoding());
+	return str;
+    }
     rb_enc_associate(str, eenc);
     return rb_str_conv_enc(str, eenc, rb_default_internal_encoding());
 }
Index: ruby_1_9_1/parse.y
===================================================================
--- ruby_1_9_1/parse.y	(revision 21071)
+++ ruby_1_9_1/parse.y	(revision 21072)
@@ -7931,13 +7931,8 @@
 	return NEW_FALSE();
     }
     else if (id == keyword__FILE__) {
-	VALUE str = rb_external_str_new_with_enc(ruby_sourcefile, strlen(ruby_sourcefile),
-						 rb_filesystem_encoding());
-	if (rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT &&
-	    ENCODING_GET(str) == rb_usascii_encindex()) {
-	    rb_enc_associate(str, rb_ascii8bit_encoding());
-	}
-	return NEW_STR(str);
+	return NEW_STR(rb_external_str_new_with_enc(ruby_sourcefile, strlen(ruby_sourcefile),
+						    rb_filesystem_encoding()));
     }
     else if (id == keyword__LINE__) {
 	return NEW_LIT(INT2FIX(ruby_sourceline));

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

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