зеркало из https://github.com/github/ruby.git
* re.c (rb_reg_regsub): don't repeat repl twice with
"X".sub!(/./, sprintf("\\%c", 255)). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
adc639bb26
Коммит
583a4b1774
|
@ -1,3 +1,8 @@
|
|||
Mon Feb 18 00:33:03 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* re.c (rb_reg_regsub): don't repeat repl twice with
|
||||
"X".sub!(/./, sprintf("\\%c", 255)).
|
||||
|
||||
Sun Feb 17 23:06:55 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||
|
||||
* lib/cgi.rb (CGI::escapeHTML): use gsub with Hash. [ruby-dev:33828]
|
||||
|
|
1
re.c
1
re.c
|
@ -2985,6 +2985,7 @@ rb_reg_regsub(VALUE str, VALUE src, struct re_registers *regs, VALUE regexp)
|
|||
if (c == -1) {
|
||||
s += mbclen(s, e, str_enc);
|
||||
rb_enc_str_buf_cat(val, ss, s-ss, str_enc);
|
||||
p = s;
|
||||
continue;
|
||||
}
|
||||
s += clen;
|
||||
|
|
|
@ -407,7 +407,7 @@ class TestRegexp < Test::Unit::TestCase
|
|||
assert_equal("fooXXXbaz", "foobarbaz".sub!(/bar/, "XXX"))
|
||||
s = [0xff].pack("C")
|
||||
assert_equal(s, "X".sub!(/./, s))
|
||||
assert_equal('\\' + s + '\\' + s, "X".sub!(/./, '\\' + s)) # ???
|
||||
assert_equal('\\' + s, "X".sub!(/./, '\\' + s))
|
||||
assert_equal('\k', "foo".sub!(/.../, '\k'))
|
||||
assert_raise(RuntimeError) { "foo".sub!(/(?<x>o)/, '\k<x') }
|
||||
assert_equal('foo[bar]baz', "foobarbaz".sub!(/(b..)/, '[\0]'))
|
||||
|
|
Загрузка…
Ссылка в новой задаче