parse.y: guard dup string
* parse.y (rb_str_dynamic_intern): prevent a string which may be duplicated, from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ad8ed59ab9
commit
33b8663f1b
6
parse.y
6
parse.y
@ -10667,10 +10667,9 @@ rb_gc_free_dsymbol(VALUE ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_str_dynamic_intern(VALUE s)
|
rb_str_dynamic_intern(VALUE str)
|
||||||
{
|
{
|
||||||
#if USE_SYMBOL_GC
|
#if USE_SYMBOL_GC
|
||||||
VALUE str = RB_GC_GUARD(s);
|
|
||||||
rb_encoding *enc, *ascii;
|
rb_encoding *enc, *ascii;
|
||||||
VALUE dsym;
|
VALUE dsym;
|
||||||
ID id, type;
|
ID id, type;
|
||||||
@ -10702,11 +10701,12 @@ rb_str_dynamic_intern(VALUE s)
|
|||||||
|
|
||||||
if (RUBY_DTRACE_SYMBOL_CREATE_ENABLED()) {
|
if (RUBY_DTRACE_SYMBOL_CREATE_ENABLED()) {
|
||||||
RUBY_DTRACE_SYMBOL_CREATE(RSTRING_PTR(str), rb_sourcefile(), rb_sourceline());
|
RUBY_DTRACE_SYMBOL_CREATE(RSTRING_PTR(str), rb_sourcefile(), rb_sourceline());
|
||||||
|
RB_GC_GUARD(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dsym;
|
return dsym;
|
||||||
#else
|
#else
|
||||||
return rb_str_intern(s);
|
return rb_str_intern(str);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user