ruby-changes:2683
From: ko1@a...
Date: 10 Dec 2007 16:53:13 +0900
Subject: [ruby-changes:2683] nobu - Ruby:r14174 (trunk): * string.c (rb_str_insert): should not add length in bytes to index in
nobu 2007-12-10 16:52:19 +0900 (Mon, 10 Dec 2007) New Revision: 14174 Modified files: trunk/ChangeLog trunk/string.c Log: * string.c (rb_str_insert): should not add length in bytes to index in chars. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=14174&r2=14173 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14174&r2=14173 Index: ChangeLog =================================================================== --- ChangeLog (revision 14173) +++ ChangeLog (revision 14174) @@ -1,3 +1,8 @@ +Mon Dec 10 16:52:17 2007 Nobuyoshi Nakada <nobu@r...> + + * string.c (rb_str_insert): should not add length in bytes to index in + chars. + Mon Dec 10 14:33:50 2007 Yukihiro Matsumoto <matz@r...> * eval.c (rb_f_public_send): rename invoke_method to public_send. Index: string.c =================================================================== --- string.c (revision 14173) +++ string.c (revision 14174) @@ -2247,7 +2247,7 @@ long pos = NUM2LONG(idx); if (pos == -1) { - pos = RSTRING_LEN(str); + return rb_str_append(str, str2); } else if (pos < 0) { pos++; @@ -2655,9 +2655,9 @@ STR_SET_NOEMBED(str); RSTRING(str)->as.heap.ptr = ALLOC_N(char,len+1); memcpy(RSTRING_PTR(str), RSTRING_PTR(str2), len+1); - FL_SET(str, STR_ASSOC); + FL_SET(str, STR_ASSOC); RSTRING(str)->as.heap.aux.shared = RSTRING(str2)->as.heap.aux.shared; - } + } else { rb_str_modify(str); rb_str_resize(str, len); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml