ruby-changes:2724
From: ko1@a...
Date: 13 Dec 2007 20:52:32 +0900
Subject: [ruby-changes:2724] akr - Ruby:r14215 (trunk): * string.c (rb_str_shared_replace): make str noembed after free.
akr 2007-12-13 20:52:15 +0900 (Thu, 13 Dec 2007)
New Revision: 14215
Modified files:
trunk/.gdbinit
trunk/ChangeLog
trunk/string.c
trunk/test/ruby/test_string.rb
Log:
* string.c (rb_str_shared_replace): make str noembed after free.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_string.rb?r1=14215&r2=14214
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=14215&r2=14214
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/.gdbinit?r1=14215&r2=14214
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14215&r2=14214
Index: .gdbinit
===================================================================
--- .gdbinit (revision 14214)
+++ .gdbinit (revision 14215)
@@ -56,7 +56,19 @@
((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
Index: ChangeLog
===================================================================
--- ChangeLog (revision 14214)
+++ ChangeLog (revision 14215)
@@ -1,3 +1,7 @@
+Thu Dec 13 20:31:28 2007 Tanaka Akira <akr@f...>
+
+ * string.c (rb_str_shared_replace): make str noembed after free.
+
Thu Dec 13 20:09:09 2007 Tanaka Akira <akr@f...>
* eval.c (rb_protect): restore root_jmpbuf to avoid SEGV by
Index: string.c
===================================================================
--- string.c (revision 14214)
+++ string.c (revision 14215)
@@ -402,10 +402,10 @@
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);
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb (revision 14214)
+++ test/ruby/test_string.rb (revision 14215)
@@ -1091,6 +1091,9 @@
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
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml