From adbdd97d28336b1be05d64d4aeda78ef1812a859 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 1 Nov 2013 07:55:56 +0000 Subject: 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 --- transcode.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index 4a86f84d1b..92fd806597 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; -- cgit v1.2.1