mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_set_len): rb_str_modify cannot work before the
length is set, which is a precondition for rb_str_modify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
99d96a89ce
commit
36044b0773
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Aug 4 19:37:00 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_set_len): rb_str_modify cannot work before the
|
||||||
|
length is set, which is a precondition for rb_str_modify.
|
||||||
|
|
||||||
Wed Aug 4 16:09:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Aug 4 16:09:43 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_resize): should copy the content properly. a
|
* string.c (rb_str_resize): should copy the content properly. a
|
||||||
|
|
2
string.c
2
string.c
|
@ -1692,7 +1692,7 @@ rb_str_unlocktmp(VALUE str)
|
||||||
void
|
void
|
||||||
rb_str_set_len(VALUE str, long len)
|
rb_str_set_len(VALUE str, long len)
|
||||||
{
|
{
|
||||||
rb_str_modify(str);
|
str_modifiable(str);
|
||||||
STR_SET_LEN(str, len);
|
STR_SET_LEN(str, len);
|
||||||
RSTRING_PTR(str)[len] = '\0';
|
RSTRING_PTR(str)[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue