diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-08-12 14:20:18 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-08-18 22:17:48 +0900 |
| commit | f1767fd079a74ca5c5ec77f101816b7d657509d8 (patch) | |
| tree | f74df66a1fd0ac737ece521a39746dc5a16b2843 /doc | |
| parent | 722d123b870af2a36a7ba3c0b5228b340269044b (diff) | |
| download | mruby-f1767fd079a74ca5c5ec77f101816b7d657509d8.tar.gz mruby-f1767fd079a74ca5c5ec77f101816b7d657509d8.zip | |
Separate `mrb_str_buf_new` and `mrb_str_new_capa`.
`mrb_str_buf_new` is an old function that ensures capacity size of
`MRB_STR_BUF_MIN_SIZE` minimum. Usually one need to use
`mrb_str_new_capa` instead.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/guides/gc-arena-howto.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/guides/gc-arena-howto.md b/doc/guides/gc-arena-howto.md index d6659c831..aff7360e9 100644 --- a/doc/guides/gc-arena-howto.md +++ b/doc/guides/gc-arena-howto.md @@ -114,14 +114,14 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list) mrb_ary_push(mrb, list, ary); - arystr = mrb_str_buf_new(mrb, 64); - mrb_str_buf_cat(mrb, arystr, head, sizeof(head)); + arystr = mrb_str_new_capa(mrb, 64); + mrb_str_cat(mrb, arystr, head, sizeof(head)); for(i=0; i<RARRAY_LEN(ary); i++) { int ai = mrb_gc_arena_save(mrb); if (i > 0) { - mrb_str_buf_cat(mrb, arystr, sep, sizeof(sep)); + mrb_str_cat(mrb, arystr, sep, sizeof(sep)); } if (mrb_array_p(RARRAY_PTR(ary)[i])) { s = inspect_ary(mrb, RARRAY_PTR(ary)[i], list); @@ -129,11 +129,11 @@ inspect_ary(mrb_state *mrb, mrb_value ary, mrb_value list) else { s = mrb_inspect(mrb, RARRAY_PTR(ary)[i]); } - mrb_str_buf_cat(mrb, arystr, RSTRING_PTR(s), RSTRING_LEN(s)); + mrb_str_cat(mrb, arystr, RSTRING_PTR(s), RSTRING_LEN(s)); mrb_gc_arena_restore(mrb, ai); } - mrb_str_buf_cat(mrb, arystr, tail, sizeof(tail)); + mrb_str_cat(mrb, arystr, tail, sizeof(tail)); mrb_ary_pop(mrb, list); return arystr; |
