summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-08-26 10:06:32 -0400
committerPeter Zhu <peter@peterzhu.ca>2021-10-25 13:26:23 -0400
commita5b6598192c30187b19b892af3110a46f6a70d76 (patch)
tree4620f69a10659deb6f278b36c10ec7915194573e /transcode.c
parent6374be5a8188ff5ed2c70b9f1d76672c87a0eda7 (diff)
downloadruby-a5b6598192c30187b19b892af3110a46f6a70d76.tar.gz
[Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and uses Variable Width Allocation to allocate strings.
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/transcode.c b/transcode.c
index 0681288346..d7011443f8 100644
--- a/transcode.c
+++ b/transcode.c
@@ -3769,7 +3769,11 @@ econv_primitive_convert(int argc, VALUE *argv, VALUE self)
rb_str_modify(output);
if (NIL_P(output_bytesize_v)) {
+#if USE_RVARGC
+ output_bytesize = rb_str_capacity(output);
+#else
output_bytesize = RSTRING_EMBED_LEN_MAX;
+#endif
if (!NIL_P(input) && output_bytesize < RSTRING_LEN(input))
output_bytesize = RSTRING_LEN(input);
}