mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Use mrb_str_cat() instead of mrb_str_cat2() as possible.
This commit is contained in:
+2
-2
@@ -1354,7 +1354,7 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
|
||||
mrb_value s = mrb_str_new(mrb, "#<", 2);
|
||||
mrb_value v = mrb_iv_get(mrb, klass, mrb_intern2(mrb, "__attached__", 12));
|
||||
|
||||
mrb_str_cat2(mrb, s, "Class:");
|
||||
mrb_str_cat(mrb, s, "Class:", 6);
|
||||
switch (mrb_type(v)) {
|
||||
case MRB_TT_CLASS:
|
||||
case MRB_TT_MODULE:
|
||||
@@ -1365,7 +1365,7 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
|
||||
mrb_str_append(mrb, s, mrb_any_to_s(mrb, v));
|
||||
break;
|
||||
}
|
||||
mrb_str_cat2(mrb, s, ">");
|
||||
mrb_str_cat(mrb, s, ">", 1);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
+6
-6
@@ -129,25 +129,25 @@ exc_inspect(mrb_state *mrb, mrb_value exc)
|
||||
|
||||
if (!mrb_nil_p(file) && !mrb_nil_p(line)) {
|
||||
str = file;
|
||||
mrb_str_cat2(mrb, str, ":");
|
||||
mrb_str_cat(mrb, str, ":", 1);
|
||||
mrb_str_append(mrb, str, line);
|
||||
mrb_str_cat2(mrb, str, ": ");
|
||||
mrb_str_cat(mrb, str, ": ", 2);
|
||||
if (!mrb_nil_p(mesg) && RSTRING_LEN(mesg) > 0) {
|
||||
mrb_str_append(mrb, str, mesg);
|
||||
mrb_str_cat2(mrb, str, " (");
|
||||
mrb_str_cat(mrb, str, " (", 2);
|
||||
}
|
||||
mrb_str_cat2(mrb, str, mrb_obj_classname(mrb, exc));
|
||||
if (!mrb_nil_p(mesg) && RSTRING_LEN(mesg) > 0) {
|
||||
mrb_str_cat2(mrb, str, ")");
|
||||
mrb_str_cat(mrb, str, ")", 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
str = mrb_str_new_cstr(mrb, mrb_obj_classname(mrb, exc));
|
||||
if (!mrb_nil_p(mesg) && RSTRING_LEN(mesg) > 0) {
|
||||
mrb_str_cat2(mrb, str, ": ");
|
||||
mrb_str_cat(mrb, str, ": ", 2);
|
||||
mrb_str_append(mrb, str, mesg);
|
||||
} else {
|
||||
mrb_str_cat2(mrb, str, ": ");
|
||||
mrb_str_cat(mrb, str, ": ", 2);
|
||||
mrb_str_cat2(mrb, str, mrb_obj_classname(mrb, exc));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -894,7 +894,7 @@ inspect_hash(mrb_state *mrb, mrb_value hash, int recur)
|
||||
|
||||
ai = mrb_gc_arena_save(mrb);
|
||||
|
||||
if (RSTRING_LEN(str) > 1) mrb_str_cat2(mrb, str, ", ");
|
||||
if (RSTRING_LEN(str) > 1) mrb_str_cat(mrb, str, ", ", 2);
|
||||
|
||||
str2 = mrb_inspect(mrb, kh_key(h,k));
|
||||
mrb_str_append(mrb, str, str2);
|
||||
|
||||
+2
-2
@@ -525,10 +525,10 @@ inspect_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p)
|
||||
/* need not to show internal data */
|
||||
if (RSTRING_PTR(str)[0] == '-') { /* first element */
|
||||
RSTRING_PTR(str)[0] = '#';
|
||||
mrb_str_cat2(mrb, str, " ");
|
||||
mrb_str_cat(mrb, str, " ", 1);
|
||||
}
|
||||
else {
|
||||
mrb_str_cat2(mrb, str, ", ");
|
||||
mrb_str_cat(mrb, str, ", ", 2);
|
||||
}
|
||||
s = mrb_sym2name_len(mrb, sym, &len);
|
||||
mrb_str_cat(mrb, str, s, len);
|
||||
|
||||
Reference in New Issue
Block a user