summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-01 07:55:56 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-01 07:55:56 (GMT)
commitadbdd97d28336b1be05d64d4aeda78ef1812a859 (patch)
tree0f8709cfb6895ce45c193ee63ca5156d14762174 /transcode.c
parent97b88a177371c5c60cdf7f3b8ec9943886cd19e8 (diff)
string.c: export rb_str_scrub
* string.c (rb_str_scrub): export with fixed length arguments, and allow nil as replacement string instead of omitting. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/transcode.c b/transcode.c
index 4a86f84..92fd806 100644
--- a/transcode.c
+++ b/transcode.c
@@ -2660,8 +2660,6 @@ str_transcode_enc_args(VALUE str, volatile VALUE *arg1, volatile VALUE *arg2,
return dencidx;
}
-VALUE rb_str_scrub(int argc, VALUE *argv, VALUE str);
-
static int
str_transcode0(int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts)
{
@@ -2697,14 +2695,11 @@ str_transcode0(int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts)
ECONV_XML_ATTR_QUOTE_DECORATOR)) == 0) {
if (senc && senc == denc) {
if (ecflags & ECONV_INVALID_MASK) {
+ VALUE rep = Qnil;
if (!NIL_P(ecopts)) {
- VALUE rep = rb_hash_aref(ecopts, sym_replace);
- dest = rb_str_scrub(1, &rep, str);
- }
- else {
- dest = rb_str_scrub(0, NULL, str);
+ rep = rb_hash_aref(ecopts, sym_replace);
}
- *self = dest;
+ *self = rb_str_scrub(str, rep);
return dencidx;
}
return NIL_P(arg2) ? -1 : dencidx;