string.c: return reallocated pointer

* string.c (str_fill_term): return new pointer reallocated by
  filling terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-05-30 07:20:28 +00:00
parent bfc9c3766f
commit 79a85b18cc
4 changed files with 36 additions and 1 deletions

View file

@ -18,6 +18,12 @@ class Test_StringCStr < Test::Unit::TestCase
assert_equal(0, s.cstr_term, Bug4319)
end
def test_shared
s = Bug::String.new("abcdef")*5
s = s.unterminated_substring(0, 29)
assert_equal(0, s.cstr_term, Bug4319)
end
def test_frozen
s0 = Bug::String.new("abcdefgh"*8)