ruby-changes:16861
From: nobu <ko1@a...>
Date: Wed, 4 Aug 2010 20:08:44 +0900 (JST)
Subject: [ruby-changes:16861] Ruby:r28857 (trunk): * string.c (rb_str_resize): reverted r28851. rb_str_resize cannot
nobu 2010-08-04 20:08:28 +0900 (Wed, 04 Aug 2010) New Revision: 28857 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28857 Log: * string.c (rb_str_resize): reverted r28851. rb_str_resize cannot work before the length is set. [ruby-core:31615] Removed directories: trunk/ext/-test-/bug-3652/ Removed files: trunk/test/-ext-/test_bug-3652.rb Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 28856) +++ ChangeLog (revision 28857) @@ -3,11 +3,6 @@ * 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@r...> - - * string.c (rb_str_resize): should copy the content properly. a - patch from Jeremy Evans at [ruby-core:31615]. - Wed Aug 4 15:47:21 2010 NAKAMURA Usaku <usa@r...> * lib/mkmf.rb (create_makefile): no need to create the directory Index: string.c =================================================================== --- string.c (revision 28856) +++ string.c (revision 28857) @@ -1723,7 +1723,7 @@ else if (len <= RSTRING_EMBED_LEN_MAX) { char *ptr = RSTRING(str)->as.heap.ptr; STR_SET_EMBED(str); - if (len > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, len); + if (slen > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, slen); RSTRING(str)->as.ary[len] = '\0'; STR_SET_EMBED_LEN(str, len); if (independent) xfree(ptr); Index: test/-ext-/test_bug-3652.rb =================================================================== --- test/-ext-/test_bug-3652.rb (revision 28856) +++ test/-ext-/test_bug-3652.rb (revision 28857) @@ -1,12 +0,0 @@ -require 'test/unit' -require '-test-/bug-3652/bug' - -class Test_BUG_3652 < Test::Unit::TestCase - def test_block_call_id - bug3652 = '[ruby-core:31615]' - s = "123456789012345678901234" - assert_equal(s, Bug.str_resize(127, s), bug3652) - s = "123456789" - assert_equal(s, Bug.str_resize(127, s), bug3652) - end -end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/