Merge pull request #4760 from shuujii/use-mrb_str_concat-instead-of-mrb_str_to_str-plus-mrb_str_cat_str

Use `mrb_str_concat` instead of `mrb_str_to_str` + `mrb_str_cat_str`
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-10-08 22:23:59 +09:00
committed by GitHub
+4 -4
View File
@@ -297,16 +297,16 @@ method_to_s(mrb_state *mrb, mrb_value self)
mrb_str_cat_lit(mrb, str, ": ");
rklass = mrb_class_ptr(klass);
if (mrb_class_ptr(owner) == rklass) {
mrb_str_cat_str(mrb, str, mrb_str_to_str(mrb, owner));
mrb_str_concat(mrb, str, owner);
mrb_str_cat_lit(mrb, str, "#");
mrb_str_cat_str(mrb, str, mrb_str_to_str(mrb, name));
mrb_str_concat(mrb, str, name);
}
else {
mrb_str_cat_cstr(mrb, str, mrb_class_name(mrb, rklass));
mrb_str_cat_lit(mrb, str, "(");
mrb_str_cat_str(mrb, str, mrb_str_to_str(mrb, owner));
mrb_str_concat(mrb, str, owner);
mrb_str_cat_lit(mrb, str, ")#");
mrb_str_cat_str(mrb, str, mrb_str_to_str(mrb, name));
mrb_str_concat(mrb, str, name);
}
mrb_str_cat_lit(mrb, str, ">");
return str;