[#30220] schedule for Ruby 1.8.6 — "Akinori MUSHA" <knu@...>

 ruby-core を読んでいない人もいると思うので、ここでもアナウンス

20 messages 2007/01/30

[ruby-dev:30213] Re: String#sub!{...}

From: zunda <zunda616e@...>
Date: 2007-01-29 23:09:50 UTC
List: ruby-dev #30213
zundaです

String#sub!{}の不具合、もうちょっと整理してからこちらに
ご報告を…と思っていたら直していただいちゃいました。

手元では、なかむら(う)さんのパッチを当てたRubyで、
全然最小になっていない
http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/palm-ja-proxy/blazer-ja-proxy/bin/blazer-ja-proxy?rev=1.42.2.10&only_with_tag=RUBY_DEBUG_070126&view=auto
でも期待通りの結果になることが確認できました。

西山さん、なかむら(う)さん、ありがとうございました。

--- "U.Nakamura" <[email protected]> wrote:

> こんにちは、なかむら(う)です。

> 、こんな感じでしょうか?

> Index: string.c
> ===================================================================
> --- string.c	(revision 11577)
> +++ string.c	(working copy)
> @@ -1966,7 +1966,6 @@
>  
>      pat = get_pat(argv[0], 1);
>      if (rb_reg_search(pat, str, 0, 0) >= 0) {
> -	rb_str_modify(str);
>  	match = rb_backref_get();
>  	regs = RMATCH(match)->regs;
>  
> @@ -1982,6 +1981,7 @@
>  	else {
>  	    repl = rb_reg_regsub(repl, str, regs);
>  	}
> +	rb_str_modify(str);
>  	if (OBJ_TAINTED(repl)) tainted = 1;
>  	plen = END(0) - BEG(0);
>  	if (RSTRING(repl)->len > plen) {


--------------------------------------
Start Yahoo! Auction now! Check out the cool campaign
http://pr.mail.yahoo.co.jp/auction/


In This Thread