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

ruby-changes:33351

From: nobu <ko1@a...>
Date: Wed, 26 Mar 2014 15:34:36 +0900 (JST)
Subject: [ruby-changes:33351] nobu:r45430 (trunk): parse.y: no dup US-ASCII string

nobu	2014-03-26 15:34:31 +0900 (Wed, 26 Mar 2014)

  New Revision: 45430

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

  Log:
    parse.y: no dup US-ASCII string
    
    * parse.y (rb_str_dynamic_intern): no needs to associate encoding
      if it is US-ASCII.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 45429)
+++ parse.y	(revision 45430)
@@ -10672,7 +10672,7 @@ rb_str_dynamic_intern(VALUE s) https://github.com/ruby/ruby/blob/trunk/parse.y#L10672
 #if USE_SYMBOL_GC
     VALUE str = RB_GC_GUARD(s);
     VALUE dup;
-    rb_encoding *enc;
+    rb_encoding *enc, *ascii;
     VALUE dsym;
     ID id, type;
 
@@ -10682,9 +10682,10 @@ rb_str_dynamic_intern(VALUE s) https://github.com/ruby/ruby/blob/trunk/parse.y#L10682
 
     dup = rb_str_dup(str);
     enc = rb_enc_get(str);
-    if (rb_enc_asciicompat(enc)) {
+    ascii = rb_usascii_encoding();
+    if (enc != ascii) {
 	if (sym_check_asciionly(str)) {
-	    rb_enc_associate(dup, rb_usascii_encoding());
+	    rb_enc_associate(dup, ascii);
 	}
     }
 

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

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