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

ruby-changes:42044

From: duerst <ko1@a...>
Date: Tue, 15 Mar 2016 16:29:56 +0900 (JST)
Subject: [ruby-changes:42044] duerst:r54118 (trunk): * enc/unicode.c: Eliminating common code.

duerst	2016-03-15 16:29:51 +0900 (Tue, 15 Mar 2016)

  New Revision: 54118

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

  Log:
    * enc/unicode.c: Eliminating common code.
      (with Kimihito Matsui)

  Modified files:
    trunk/ChangeLog
    trunk/enc/unicode.c
Index: enc/unicode.c
===================================================================
--- enc/unicode.c	(revision 54117)
+++ enc/unicode.c	(revision 54118)
@@ -716,7 +716,6 @@ onigenc_unicode_case_map(OnigCaseFoldTyp https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L716
 		    MODIFIED;
 		    if (flags&OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_SPECIALS) {
 			OnigCodePoint *SpecialsStart = CaseMappingSpecials + OnigSpecialIndexDecode(folded->n);
-			int count;
 
 			if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) {
 			    if (flags&ONIGENC_CASE_TITLECASE)
@@ -732,38 +731,23 @@ onigenc_unicode_case_map(OnigCaseFoldTyp https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L731
 		      SpecialsCopy:
 		        count = SpecialsLengthExtract(*SpecialsStart);
 			next = SpecialsStart;
-			if (count==1)
-			    code = SpecialsCodepointExtract(*next);
-			else if (count==2) {
-			    code = SpecialsCodepointExtract(*next++);
-			    to += ONIGENC_CODE_TO_MBC(enc, code, to);
-			    code = *next;
-			}
-			else { /* count == 3 */
-			    code = SpecialsCodepointExtract(*next++);
-			    to += ONIGENC_CODE_TO_MBC(enc, code, to);
-			    code = *next++;
-			    to += ONIGENC_CODE_TO_MBC(enc, code, to);
-			    code = *next;
-			}
+			code = SpecialsCodepointExtract(*next++);
 		    }
 		    else { /* no specials */
 			count = OnigCodePointCount(folded->n);
 			next = folded->code;
-			if (count==1)
-			    code = *next;
-			else if (count==2) {
-			    code = *next++;
-			    to += ONIGENC_CODE_TO_MBC(enc, code, to);
-			    code = *next;
-			}
-			else { /* count == 3 */
-			    code = *next++;
-			    to += ONIGENC_CODE_TO_MBC(enc, code, to);
-			    code = *next++;
-			    to += ONIGENC_CODE_TO_MBC(enc, code, to);
-			    code = *next;
-			}
+			code = *next++;
+		    }
+		    if (count==1)
+			;
+		    else if (count==2) {
+			to += ONIGENC_CODE_TO_MBC(enc, code, to);
+			code = *next;
+		    }
+		    else { /* count == 3 */
+			to += ONIGENC_CODE_TO_MBC(enc, code, to);
+			to += ONIGENC_CODE_TO_MBC(enc, *next++, to);
+			code = *next;
 		    }
 		}
 	    }
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54117)
+++ ChangeLog	(revision 54118)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Mar 15 16:29:51 2016  Martin Duerst  <duerst@i...>
+
+	* enc/unicode.c: Eliminating common code.
+	  (with Kimihito Matsui)
+
 Tue Mar 15 16:17:09 2016  Martin Duerst  <duerst@i...>
 
 	* enc/unicode.c: Expansion of some code repetition in preparation for

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

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