Skip to content

Commit bd0244d

Browse files
committed
use mrb_str_cat_lit() intead of mrb_str_cat
1 parent d1526b0 commit bd0244d

5 files changed

Lines changed: 19 additions & 19 deletions

File tree

src/class.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ mrb_class_name(mrb_state *mrb, struct RClass* c)
12961296
if (mrb_nil_p(path)) {
12971297
path = mrb_str_new_lit(mrb, "#<Class:");
12981298
mrb_str_concat(mrb, path, mrb_ptr_to_str(mrb, c));
1299-
mrb_str_cat(mrb, path, ">", 1);
1299+
mrb_str_cat_lit(mrb, path, ">");
13001300
}
13011301
return mrb_str_ptr(path)->ptr;
13021302
}
@@ -1431,7 +1431,7 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
14311431
mrb_str_append(mrb, str, mrb_any_to_s(mrb, v));
14321432
break;
14331433
}
1434-
mrb_str_cat(mrb, str, ">", 1);
1434+
mrb_str_cat_lit(mrb, str, ">");
14351435
}
14361436
else {
14371437
struct RClass *c;
@@ -1444,20 +1444,20 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
14441444
if (mrb_nil_p(path)) {
14451445
switch (mrb_type(klass)) {
14461446
case MRB_TT_CLASS:
1447-
mrb_str_cat(mrb, str, "#<Class:", 8);
1447+
mrb_str_cat_lit(mrb, str, "#<Class:");
14481448
break;
14491449

14501450
case MRB_TT_MODULE:
1451-
mrb_str_cat(mrb, str, "#<Module:", 9);
1451+
mrb_str_cat_lit(mrb, str, "#<Module:");
14521452
break;
14531453

14541454
default:
14551455
/* Shouldn't be happened? */
1456-
mrb_str_cat(mrb, str, "#<??????:", 9);
1456+
mrb_str_cat_lit(mrb, str, "#<??????:");
14571457
break;
14581458
}
14591459
mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, c));
1460-
mrb_str_cat(mrb, str, ">", 1);
1460+
mrb_str_cat_lit(mrb, str, ">");
14611461
}
14621462
else {
14631463
str = path;

src/error.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,26 +128,26 @@ exc_inspect(mrb_state *mrb, mrb_value exc)
128128

129129
if (!mrb_nil_p(file) && !mrb_nil_p(line)) {
130130
str = file;
131-
mrb_str_cat(mrb, str, ":", 1);
131+
mrb_str_cat_lit(mrb, str, ":");
132132
mrb_str_append(mrb, str, line);
133-
mrb_str_cat(mrb, str, ": ", 2);
133+
mrb_str_cat_lit(mrb, str, ": ");
134134
if (!mrb_nil_p(mesg) && RSTRING_LEN(mesg) > 0) {
135135
mrb_str_append(mrb, str, mesg);
136-
mrb_str_cat(mrb, str, " (", 2);
136+
mrb_str_cat_lit(mrb, str, " (");
137137
}
138138
mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, exc));
139139
if (!mrb_nil_p(mesg) && RSTRING_LEN(mesg) > 0) {
140-
mrb_str_cat(mrb, str, ")", 1);
140+
mrb_str_cat_lit(mrb, str, ")");
141141
}
142142
}
143143
else {
144144
str = mrb_str_new_cstr(mrb, mrb_obj_classname(mrb, exc));
145145
if (!mrb_nil_p(mesg) && RSTRING_LEN(mesg) > 0) {
146-
mrb_str_cat(mrb, str, ": ", 2);
146+
mrb_str_cat_lit(mrb, str, ": ");
147147
mrb_str_append(mrb, str, mesg);
148148
}
149149
else {
150-
mrb_str_cat(mrb, str, ": ", 2);
150+
mrb_str_cat_lit(mrb, str, ": ");
151151
mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, exc));
152152
}
153153
}

src/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ inspect_hash(mrb_state *mrb, mrb_value hash, int recur)
672672

673673
ai = mrb_gc_arena_save(mrb);
674674

675-
if (RSTRING_LEN(str) > 1) mrb_str_cat(mrb, str, ", ", 2);
675+
if (RSTRING_LEN(str) > 1) mrb_str_cat_lit(mrb, str, ", ");
676676

677677
str2 = mrb_inspect(mrb, kh_key(h,k));
678678
mrb_str_append(mrb, str, str2);

src/object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ mrb_any_to_s(mrb_state *mrb, mrb_value obj)
444444

445445
mrb_str_buf_cat(mrb, str, "#<", 2);
446446
mrb_str_cat_cstr(mrb, str, cname);
447-
mrb_str_cat(mrb, str, ":", 1);
447+
mrb_str_cat_lit(mrb, str, ":");
448448
mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, mrb_cptr(obj)));
449449
mrb_str_buf_cat(mrb, str, ">", 1);
450450

src/variable.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,14 +568,14 @@ inspect_i(mrb_state *mrb, mrb_sym sym, mrb_value v, void *p)
568568
/* need not to show internal data */
569569
if (RSTRING_PTR(str)[0] == '-') { /* first element */
570570
RSTRING_PTR(str)[0] = '#';
571-
mrb_str_cat(mrb, str, " ", 1);
571+
mrb_str_cat_lit(mrb, str, " ");
572572
}
573573
else {
574-
mrb_str_cat(mrb, str, ", ", 2);
574+
mrb_str_cat_lit(mrb, str, ", ");
575575
}
576576
s = mrb_sym2name_len(mrb, sym, &len);
577577
mrb_str_cat(mrb, str, s, len);
578-
mrb_str_cat(mrb, str, "=", 1);
578+
mrb_str_cat_lit(mrb, str, "=");
579579
if (mrb_type(v) == MRB_TT_OBJECT) {
580580
ins = mrb_any_to_s(mrb, v);
581581
}
@@ -598,11 +598,11 @@ mrb_obj_iv_inspect(mrb_state *mrb, struct RObject *obj)
598598

599599
mrb_str_buf_cat(mrb, str, "-<", 2);
600600
mrb_str_cat_cstr(mrb, str, cn);
601-
mrb_str_cat(mrb, str, ":", 1);
601+
mrb_str_cat_lit(mrb, str, ":");
602602
mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, obj));
603603

604604
iv_foreach(mrb, t, inspect_i, &str);
605-
mrb_str_cat(mrb, str, ">", 1);
605+
mrb_str_cat_lit(mrb, str, ">");
606606
return str;
607607
}
608608
return mrb_any_to_s(mrb, mrb_obj_value(obj));

0 commit comments

Comments
 (0)