diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-10-12 21:32:56 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-10-12 21:32:56 +0900 |
| commit | 7594983671da2871036af5e6437e106b159d04de (patch) | |
| tree | 388a3a3f270ac42eec38f38d5fc96c75d8cb6e37 /src/string.c | |
| parent | c310c8dc24c593adb86ac15b3ef6282248b75c9f (diff) | |
| download | mruby-7594983671da2871036af5e6437e106b159d04de.tar.gz mruby-7594983671da2871036af5e6437e106b159d04de.zip | |
SHARED string is not required when sharing POOL string
The heap string buffer of POOL string always exists, does not need to be
released, and read only, so it can be shared as NOFREE string.
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/string.c b/src/string.c index a45dee11e..41aa4b779 100644 --- a/src/string.c +++ b/src/string.c @@ -526,7 +526,7 @@ str_make_shared(mrb_state *mrb, struct RString *orig, struct RString *s) size_t len = (size_t)orig->as.heap.len; mrb_assert(!RSTR_EMBED_P(orig)); - if (RSTR_NOFREE_P(orig)) { + if (RSTR_NOFREE_P(orig) || RSTR_POOL_P(orig)) { str_init_nofree(s, orig->as.heap.ptr, len); } else if (RSTR_SHARED_P(orig)) { @@ -535,7 +535,7 @@ str_make_shared(mrb_state *mrb, struct RString *orig, struct RString *s) else if (RSTR_FSHARED_P(orig)) { str_init_fshared(orig, s, orig->as.heap.aux.fshared); } - else if (mrb_frozen_p(orig) && !RSTR_POOL_P(orig)) { + else if (mrb_frozen_p(orig)) { str_init_fshared(orig, s, orig); } else { |
