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

ruby-changes:43257

From: duerst <ko1@a...>
Date: Wed, 8 Jun 2016 22:22:33 +0900 (JST)
Subject: [ruby-changes:43257] duerst:r55331 (trunk): * string.c: Revert previous commit (possibility of endless loop).

duerst	2016-06-08 22:22:28 +0900 (Wed, 08 Jun 2016)

  New Revision: 55331

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

  Log:
    * string.c: Revert previous commit (possibility of endless loop).

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 55330)
+++ string.c	(revision 55331)
@@ -5871,6 +5871,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/string.c#L5871
 rb_str_upcase_bang(int argc, VALUE *argv, VALUE str)
 {
     rb_encoding *enc;
+    int modify = 0;
     OnigCaseFoldType flags = ONIGENC_CASE_UPCASE;
 
     flags = check_case_options(argc, argv, flags);
@@ -5886,17 +5887,17 @@ rb_str_upcase_bang(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/string.c#L5887
 
 	    if (rb_enc_isascii(c, enc) && 'a' <= c && c <= 'z') {
 		*s = 'A' + (c - 'a');
-		flags |= ONIGENC_CASE_MODIFIED;
+		modify = 1;
 	    }
 	    s++;
 	}
     }
-    else if (flags&ONIGENC_CASE_ASCII_ONLY)
-        rb_str_ascii_casemap(str, &flags, enc);
-    else
+    else {
 	str_shared_replace(str, rb_str_casemap(str, &flags, enc));
+	modify = ONIGENC_CASE_MODIFIED & flags;
+    }
 
-    if (ONIGENC_CASE_MODIFIED&flags) return str;
+    if (modify) return str;
     return Qnil;
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55330)
+++ ChangeLog	(revision 55331)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun  8 22:22:24 2016  Martin Duerst  <duerst@i...>
+
+	* string.c: Revert previous commit (possibility of endless loop).
+
 Wed Jun  8 21:57:41 2016  Martin Duerst  <duerst@i...>
 
 	* string.c: Special-case :ascii option in rb_str_upcase_bang.

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

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