[前][次][番号順一覧][スレッド一覧]

ruby-changes:43287

From: duerst <ko1@a...>
Date: Fri, 10 Jun 2016 17:35:21 +0900 (JST)
Subject: [ruby-changes:43287] duerst:r55361 (trunk): * string.c: Special-case :ascii option in rb_str_capitalize_bang and

duerst	2016-06-10 17:35:17 +0900 (Fri, 10 Jun 2016)

  New Revision: 55361

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55361

  Log:
    * string.c: Special-case :ascii option in rb_str_capitalize_bang and
      rb_str_swapcase_bang.

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55360)
+++ ChangeLog	(revision 55361)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 10 17:35:11 2016  Martin Duerst  <duerst@i...>
+
+	* 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@i...>
 
 	* string.c: Special-case :ascii option in rb_str_upcase_bang (retry).
Index: string.c
===================================================================
--- string.c	(revision 55360)
+++ string.c	(revision 55361)
@@ -6053,7 +6053,10 @@ rb_str_capitalize_bang(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/string.c#L6053
     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 *ar https://github.com/ruby/ruby/blob/trunk/string.c#L6108
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]