1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
duerst 2016-06-10 08:35:17 +00:00
parent 13f576d6b9
commit 10174c295b
2 changed files with 13 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Fri Jun 10 17:35:11 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* string.c: Special-case :ascii option in rb_str_capitalize_bang and
rb_str_swapcase_bang.
Fri Jun 10 17:12:24 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* string.c: Special-case :ascii option in rb_str_upcase_bang (retry).

View file

@ -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;