diff options
-rw-r--r-- | .gdbinit | 14 | ||||
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | string.c | 2 | ||||
-rw-r--r-- | test/ruby/test_string.rb | 3 |
4 files changed, 21 insertions, 2 deletions
@@ -56,7 +56,19 @@ define rp ((struct RString*)$arg0)->as.heap.ptr : \ ((struct RString*)$arg0)->as.ary) set print address on - printf " encoding:%d ", ($flags & (RUBY_FL_USER8|RUBY_FL_USER9|RUBY_FL_USER10|RUBY_FL_USER11)) >> RUBY_ENCODING_SHIFT + printf " bytesize:%d ", ($flags & RUBY_FL_USER1) ? \ + ((struct RString*)$arg0)->as.heap.len : \ + (($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2) + if !($flags & RUBY_FL_USER1) + printf "(embed) " + end + if ($flags & RUBY_FL_USER2) + printf "(shared) " + end + if ($flags & RUBY_FL_USER3) + printf "(assoc) " + end + printf "encoding:%d ", ($flags & (RUBY_FL_USER8|RUBY_FL_USER9|RUBY_FL_USER10|RUBY_FL_USER11)) >> RUBY_ENCODING_SHIFT if ($flags & (RUBY_FL_USER12|RUBY_FL_USER13)) == 0 printf "coderange:unknown " else @@ -1,3 +1,7 @@ +Thu Dec 13 20:31:28 2007 Tanaka Akira <akr@fsij.org> + + * string.c (rb_str_shared_replace): make str noembed after free. + Thu Dec 13 20:09:09 2007 Tanaka Akira <akr@fsij.org> * eval.c (rb_protect): restore root_jmpbuf to avoid SEGV by @@ -402,10 +402,10 @@ rb_str_shared_replace(VALUE str, VALUE str2) STR_SET_EMBED_LEN(str, RSTRING_LEN(str2)); return; } - STR_SET_NOEMBED(str); if (!STR_SHARED_P(str) && !STR_EMBED_P(str)) { free(RSTRING_PTR(str)); } + STR_SET_NOEMBED(str); STR_UNSET_NOCAPA(str); RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2); RSTRING(str)->as.heap.len = RSTRING_LEN(str2); diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 5657197834..b2d8ab8a09 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1091,6 +1091,9 @@ class TestString < Test::Unit::TestCase a = S("**") assert_equal(S("*+"), a.succ!) assert_equal(S("*+"), a) + + assert_equal("aaaaaaaaaaaa", "zzzzzzzzzzz".succ!) + assert_equal("aaaaaaaaaaaaaaaaaaaaaaaa", "zzzzzzzzzzzzzzzzzzzzzzz".succ!) end def test_sum |