* 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:
parent
13f576d6b9
commit
10174c295b
@ -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>
|
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).
|
* string.c: Special-case :ascii option in rb_str_upcase_bang (retry).
|
||||||
|
6
string.c
6
string.c
@ -6053,6 +6053,9 @@ rb_str_capitalize_bang(int argc, VALUE *argv, VALUE str)
|
|||||||
enc = STR_ENC_GET(str);
|
enc = STR_ENC_GET(str);
|
||||||
rb_str_check_dummy_enc(enc);
|
rb_str_check_dummy_enc(enc);
|
||||||
if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil;
|
if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil;
|
||||||
|
if (flags&ONIGENC_CASE_ASCII_ONLY)
|
||||||
|
rb_str_ascii_casemap(str, &flags, enc);
|
||||||
|
else
|
||||||
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
|
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
|
||||||
|
|
||||||
if (ONIGENC_CASE_MODIFIED&flags) return str;
|
if (ONIGENC_CASE_MODIFIED&flags) return str;
|
||||||
@ -6105,6 +6108,9 @@ rb_str_swapcase_bang(int argc, VALUE *argv, VALUE str)
|
|||||||
str_modify_keep_cr(str);
|
str_modify_keep_cr(str);
|
||||||
enc = STR_ENC_GET(str);
|
enc = STR_ENC_GET(str);
|
||||||
rb_str_check_dummy_enc(enc);
|
rb_str_check_dummy_enc(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));
|
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
|
||||||
|
|
||||||
if (ONIGENC_CASE_MODIFIED&flags) return str;
|
if (ONIGENC_CASE_MODIFIED&flags) return str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user