Avoid unnecessary `Symbol#to_s` call; fix #4812

parent 1a0c7998
......@@ -1943,15 +1943,10 @@ mrb_str_intern(mrb_state *mrb, mrb_value self)
MRB_API mrb_value
mrb_obj_as_string(mrb_state *mrb, mrb_value obj)
{
mrb_value str;
if (mrb_string_p(obj)) {
return obj;
}
str = mrb_funcall(mrb, obj, "to_s", 0);
if (!mrb_string_p(str))
return mrb_any_to_s(mrb, obj);
return str;
return mrb_str_to_str(mrb, obj);
}
MRB_API mrb_value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment