1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/erb] Optimize away the rb_convert_type call using RB_TYPE_P

https://github.com/ruby/erb/commit/12058c3784
This commit is contained in:
Takashi Kokubun 2022-11-05 00:41:52 -07:00 committed by git
parent e8873e01b6
commit 458d6fb15e

View file

@ -76,7 +76,9 @@ optimized_escape_html(VALUE str)
static VALUE
erb_escape_html(VALUE self, VALUE str)
{
str = rb_convert_type(str, T_STRING, "String", "to_s");
if (!RB_TYPE_P(str, T_STRING)) {
str = rb_convert_type(str, T_STRING, "String", "to_s");
}
if (rb_enc_str_asciicompat_p(str)) {
return optimized_escape_html(str);