diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-10 08:35:17 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-10 08:35:17 +0000 |
commit | 10174c295b91ef1370d3c910755d79c895d0ef32 (patch) | |
tree | e92c83d7fd5b54fafac022126c03e00471295002 /string.c | |
parent | 13f576d6b9f76c6ab2e6762dc78697309dac3708 (diff) | |
download | ruby-10174c295b91ef1370d3c910755d79c895d0ef32.tar.gz |
* string.c: Special-case :ascii option in rb_str_capitalize_bang and
rb_str_swapcase_bang.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -6053,7 +6053,10 @@ rb_str_capitalize_bang(int argc, VALUE *argv, VALUE str) enc = STR_ENC_GET(str); rb_str_check_dummy_enc(enc); if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil; - str_shared_replace(str, rb_str_casemap(str, &flags, enc)); + if (flags&ONIGENC_CASE_ASCII_ONLY) + rb_str_ascii_casemap(str, &flags, enc); + else + str_shared_replace(str, rb_str_casemap(str, &flags, enc)); if (ONIGENC_CASE_MODIFIED&flags) return str; return Qnil; @@ -6105,7 +6108,10 @@ rb_str_swapcase_bang(int argc, VALUE *argv, VALUE str) str_modify_keep_cr(str); enc = STR_ENC_GET(str); rb_str_check_dummy_enc(enc); - str_shared_replace(str, rb_str_casemap(str, &flags, enc)); + if (flags&ONIGENC_CASE_ASCII_ONLY) + rb_str_ascii_casemap(str, &flags, enc); + else + str_shared_replace(str, rb_str_casemap(str, &flags, enc)); if (ONIGENC_CASE_MODIFIED&flags) return str; return Qnil; |