Skip to content

Commit 12058c3

Browse files
committed
Optimize away the rb_convert_type call using RB_TYPE_P
1 parent af26da2 commit 12058c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ext/erb/erb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ optimized_escape_html(VALUE str)
7676
static VALUE
7777
erb_escape_html(VALUE self, VALUE str)
7878
{
79-
str = rb_convert_type(str, T_STRING, "String", "to_s");
79+
if (!RB_TYPE_P(str, T_STRING)) {
80+
str = rb_convert_type(str, T_STRING, "String", "to_s");
81+
}
8082

8183
if (rb_enc_str_asciicompat_p(str)) {
8284
return optimized_escape_html(str);

0 commit comments

Comments
 (0)