use mrb_str_cat_str() instead of mrb_str_append()

If the argument is always a string, then mrb_str_cat_str() can be
directly called instead of indirectly by mrb_str_append().

mrb_any_to_s(), mrb_obj_as_string(), mrb_inspect() always return a
string.
This commit is contained in:
cremno
2015-07-16 03:56:31 +02:00
parent 207577f0af
commit 938ed044f4
4 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -152,7 +152,7 @@ exc_inspect(mrb_state *mrb, mrb_value exc)
mrb_str_append(mrb, str, line);
mrb_str_cat_lit(mrb, str, ": ");
if (append_mesg) {
mrb_str_append(mrb, str, mesg);
mrb_str_cat_str(mrb, str, mesg);
mrb_str_cat_lit(mrb, str, " (");
}
mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, exc));
@@ -165,7 +165,7 @@ exc_inspect(mrb_state *mrb, mrb_value exc)
str = mrb_str_new_cstr(mrb, cname);
mrb_str_cat_lit(mrb, str, ": ");
if (append_mesg) {
mrb_str_append(mrb, str, mesg);
mrb_str_cat_str(mrb, str, mesg);
}
else {
mrb_str_cat_cstr(mrb, str, cname);