summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-11 01:03:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-11 01:03:37 +0000
commitc763f0fb9b812e8b0fb77192d00db338d9095f61 (patch)
tree3089e30811f9bf6cdcd548072002f7405a3f43e5 /string.c
parente4a2dd5f5250885b786d181244ed1f24a38fccf5 (diff)
string.c: block for scrub with ASCII-incompatible
* string.c (rb_enc_str_scrub): honor the given block with ASCII-incompatible encoding. [ruby-core:79039] [Bug #13120] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/string.c b/string.c
index 494dc1d90e..c01f2e595b 100644
--- a/string.c
+++ b/string.c
@@ -9345,7 +9345,11 @@ rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl)
const char *e = RSTRING_END(str);
const char *p1 = p;
long mbminlen = rb_enc_mbminlen(enc);
- if (!NIL_P(repl)) {
+ if (rb_block_given_p()) {
+ rep = NULL;
+ replen = 0;
+ }
+ else if (!NIL_P(repl)) {
rep = RSTRING_PTR(repl);
replen = RSTRING_LEN(repl);
}