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

ruby-changes:33352

From: nobu <ko1@a...>
Date: Wed, 26 Mar 2014 15:34:45 +0900 (JST)
Subject: [ruby-changes:33352] nobu:r45432 (trunk): parse.y: guard dup string

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

  New Revision: 45432

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

  Log:
    parse.y: guard dup string
    
    * parse.y (rb_str_dynamic_intern): prevent a string which may be
      duplicated, from GC.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 45431)
+++ parse.y	(revision 45432)
@@ -10667,10 +10667,9 @@ rb_gc_free_dsymbol(VALUE ptr) https://github.com/ruby/ruby/blob/trunk/parse.y#L10667
 }
 
 VALUE
-rb_str_dynamic_intern(VALUE s)
+rb_str_dynamic_intern(VALUE str)
 {
 #if USE_SYMBOL_GC
-    VALUE str = RB_GC_GUARD(s);
     rb_encoding *enc, *ascii;
     VALUE dsym;
     ID id, type;
@@ -10702,11 +10701,12 @@ rb_str_dynamic_intern(VALUE s) https://github.com/ruby/ruby/blob/trunk/parse.y#L10701
 
     if (RUBY_DTRACE_SYMBOL_CREATE_ENABLED()) {
 	RUBY_DTRACE_SYMBOL_CREATE(RSTRING_PTR(str), rb_sourcefile(), rb_sourceline());
+	RB_GC_GUARD(str);
     }
 
     return dsym;
 #else
-    return rb_str_intern(s);
+    return rb_str_intern(str);
 #endif
 }
 

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

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