ruby-changes:13751
From: yugui <ko1@a...>
Date: Thu, 29 Oct 2009 01:11:36 +0900 (JST)
Subject: [ruby-changes:13751] Ruby:r25546 (ruby_1_9_1): merges r24679 from trunk into ruby_1_9_1.
yugui 2009-10-29 01:11:20 +0900 (Thu, 29 Oct 2009) New Revision: 25546 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25546 Log: merges r24679 from trunk into ruby_1_9_1. -- * ext/strscan/strscan.c (strscan_set_string): set string should not be dupped or frozen, because freezing it causes #concat method failure, and unnecessary to dup without freezing. a patch from Aaron Patterson at [ruby-core:25145]. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/ext/strscan/strscan.c branches/ruby_1_9_1/test/strscan/test_stringscanner.rb branches/ruby_1_9_1/version.h Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 25545) +++ ruby_1_9_1/ChangeLog (revision 25546) @@ -1,3 +1,10 @@ +Thu Aug 27 08:16:34 2009 Nobuyoshi Nakada <nobu@r...> + + * ext/strscan/strscan.c (strscan_set_string): set string should not be + dupped or frozen, because freezing it causes #concat method failure, + and unnecessary to dup without freezing. a patch from Aaron + Patterson at [ruby-core:25145]. + Wed Aug 26 12:36:58 2009 Nobuyoshi Nakada <nobu@r...> * vm.c (collect_local_variables_in_env): skips internal variables. Index: ruby_1_9_1/ext/strscan/strscan.c =================================================================== --- ruby_1_9_1/ext/strscan/strscan.c (revision 25545) +++ ruby_1_9_1/ext/strscan/strscan.c (revision 25546) @@ -321,8 +321,7 @@ Data_Get_Struct(self, struct strscanner, p); StringValue(str); - p->str = rb_str_dup(str); - rb_obj_freeze(p->str); + p->str = str; p->curr = 0; CLEAR_MATCH_STATUS(p); return str; Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 25545) +++ ruby_1_9_1/version.h (revision 25546) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 304 +#define RUBY_PATCHLEVEL 305 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_1/test/strscan/test_stringscanner.rb =================================================================== --- ruby_1_9_1/test/strscan/test_stringscanner.rb (revision 25545) +++ ruby_1_9_1/test/strscan/test_stringscanner.rb (revision 25546) @@ -168,6 +168,26 @@ assert_equal 0, s.pos end + def test_string_set_is_equal + name = 'tenderlove' + + s = StringScanner.new(name) + assert_equal name.object_id, s.string.object_id + + s.string = name + assert_equal name.object_id, s.string.object_id + end + + def test_string_append + s = StringScanner.new('tender') + s << 'love' + assert_equal 'tenderlove', s.string + + s.string = 'tender' + s << 'love' + assert_equal 'tenderlove', s.string + end + def test_pos s = StringScanner.new('test string') assert_equal 0, s.pos -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/