diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-03-23 03:46:52 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-03-23 03:46:52 -0700 |
| commit | af2f3dd16f0d322a4d878196c1b8565cc264d625 (patch) | |
| tree | 7138d6d52cf84e65fe32c98d1b092dd9431305d9 /src | |
| parent | fe7472852255f3b265eaa32cd59e869b9528ece6 (diff) | |
| parent | 0cedf8fa02848bc505d7cda29f7266b5e03a9076 (diff) | |
| download | mruby-af2f3dd16f0d322a4d878196c1b8565cc264d625.tar.gz mruby-af2f3dd16f0d322a4d878196c1b8565cc264d625.zip | |
Merge pull request #1050 from monaka/pr-cleanup-string.c-20130323
Clean up string.c
Diffstat (limited to 'src')
| -rw-r--r-- | src/class.c | 4 | ||||
| -rw-r--r-- | src/error.c | 16 | ||||
| -rw-r--r-- | src/hash.c | 2 | ||||
| -rw-r--r-- | src/string.c | 2 | ||||
| -rw-r--r-- | src/variable.c | 4 |
5 files changed, 14 insertions, 14 deletions
diff --git a/src/class.c b/src/class.c index 8625c13eb..da898383d 100644 --- a/src/class.c +++ b/src/class.c @@ -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; } diff --git a/src/error.c b/src/error.c index 7cb6b53ef..f46887465 100644 --- a/src/error.c +++ b/src/error.c @@ -129,26 +129,26 @@ 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)); + mrb_str_cat_cstr(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_cat2(mrb, str, mrb_obj_classname(mrb, exc)); + mrb_str_cat(mrb, str, ": ", 2); + mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, exc)); } } return str; diff --git a/src/hash.c b/src/hash.c index 6976530e1..8de7b55c8 100644 --- a/src/hash.c +++ b/src/hash.c @@ -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); diff --git a/src/string.c b/src/string.c index 97d53cd6c..165cdbccd 100644 --- a/src/string.c +++ b/src/string.c @@ -2548,7 +2548,7 @@ mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, mrb_int len) } mrb_value -mrb_str_cat2(mrb_state *mrb, mrb_value str, const char *ptr) +mrb_str_cat_cstr(mrb_state *mrb, mrb_value str, const char *ptr) { return mrb_str_cat(mrb, str, ptr, strlen(ptr)); } diff --git a/src/variable.c b/src/variable.c index 4345f49a7..df89397d7 100644 --- a/src/variable.c +++ b/src/variable.c @@ -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); |
