mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/erb] Optimize away to_s if it's already T_STRING
[Feature #19102]https://github.com/ruby/erb/commit/38c6e182fb
This commit is contained in:
parent
dc5d06e9b1
commit
20efeaddbe
1 changed files with 2 additions and 9 deletions
|
@ -68,9 +68,9 @@ optimized_escape_html(VALUE str)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
cgiesc_escape_html(VALUE self, VALUE str)
|
erb_escape_html(VALUE self, VALUE str)
|
||||||
{
|
{
|
||||||
StringValue(str);
|
str = rb_convert_type(str, T_STRING, "String", "to_s");
|
||||||
|
|
||||||
if (rb_enc_str_asciicompat_p(str)) {
|
if (rb_enc_str_asciicompat_p(str)) {
|
||||||
return optimized_escape_html(str);
|
return optimized_escape_html(str);
|
||||||
|
@ -80,13 +80,6 @@ cgiesc_escape_html(VALUE self, VALUE str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
erb_escape_html(VALUE self, VALUE str)
|
|
||||||
{
|
|
||||||
str = rb_funcall(str, rb_intern("to_s"), 0);
|
|
||||||
return cgiesc_escape_html(self, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Init_erb(void)
|
Init_erb(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue