string.c: expand heap
* string.c (str_buf_cat): expand the heap buffer at making str independent, not only just copying. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b8858232f2
commit
b3626b3ee7
2
string.c
2
string.c
@ -2194,7 +2194,7 @@ str_buf_cat(VALUE str, const char *ptr, long len)
|
|||||||
if (ptr >= sptr && ptr <= sptr + olen) {
|
if (ptr >= sptr && ptr <= sptr + olen) {
|
||||||
off = ptr - sptr;
|
off = ptr - sptr;
|
||||||
}
|
}
|
||||||
rb_str_modify(str);
|
rb_str_modify_expand(str, len);
|
||||||
if (len == 0) return 0;
|
if (len == 0) return 0;
|
||||||
if (STR_EMBED_P(str)) {
|
if (STR_EMBED_P(str)) {
|
||||||
capa = RSTRING_EMBED_LEN_MAX;
|
capa = RSTRING_EMBED_LEN_MAX;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user