summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/string.c b/string.c
index 6abfcd33f8..b33d83caaf 100644
--- a/string.c
+++ b/string.c
@@ -1351,6 +1351,7 @@ rb_str_buf_new(long capa)
{
VALUE str = str_alloc(rb_cString);
+ if (capa <= RSTRING_EMBED_LEN_MAX) return str;
if (capa < STR_BUF_MIN_SIZE) {
capa = STR_BUF_MIN_SIZE;
}