summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-12-17 08:06:44 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-12-17 08:06:44 +0900
commita19a6edb7c464af9dd4303659ceabe2672882a6b (patch)
treef1a79ab32b9ab40fadd6c967ff60dc886911ed28 /mrbgems/mruby-string-ext/src/string.c
parent0c4d053a94613926a5f4bc4d5b6370aee5eec78a (diff)
downloadmruby-a19a6edb7c464af9dd4303659ceabe2672882a6b.tar.gz
mruby-a19a6edb7c464af9dd4303659ceabe2672882a6b.zip
mrb_str_new(mrb, "", len) creates an unmodifiable string object; ref #2674
Diffstat (limited to 'mrbgems/mruby-string-ext/src/string.c')
-rw-r--r--mrbgems/mruby-string-ext/src/string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-string-ext/src/string.c b/mrbgems/mruby-string-ext/src/string.c
index fa2c52d67..68d96cd6c 100644
--- a/mrbgems/mruby-string-ext/src/string.c
+++ b/mrbgems/mruby-string-ext/src/string.c
@@ -356,7 +356,7 @@ mrb_str_prepend(mrb_state *mrb, mrb_value self)
}
s2 = mrb_str_ptr(other);
len = RSTR_LEN(s1) + RSTR_LEN(s2);
- temp_str = mrb_str_new(mrb, "", RSTR_LEN(s1));
+ temp_str = mrb_str_new(mrb, NULL, RSTR_LEN(s1));
temp_s = mrb_str_ptr(temp_str);
memcpy(RSTR_PTR(temp_s), RSTR_PTR(s1), RSTR_LEN(s1));
if (RSTRING_CAPA(self) < len) {