mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_shared_replace): make str noembed after free.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
719841ca37
commit
9595af4ad5
4 changed files with 21 additions and 2 deletions
14
.gdbinit
14
.gdbinit
|
@ -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
|
||||
|
|
2
string.c
2
string.c
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue