ruby-changes:44903
From: duerst <ko1@a...>
Date: Sun, 4 Dec 2016 10:58:59 +0900 (JST)
Subject: [ruby-changes:44903] duerst:r56976 (trunk): remove special processing for U+03B9/U+03BC/U+A64B
duerst 2016-12-04 10:58:54 +0900 (Sun, 04 Dec 2016) New Revision: 56976 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56976 Log: remove special processing for U+03B9/U+03BC/U+A64B * enc/unicode.c: Remove special processing for U+03B9/U+03BC/U+A64B (GREEK SMALL LETTERs IOTA/MU, CYRILLIC SMALL LETTER MONOGRAPH UK) from onigenc_unicode_case_map and simplify code. * enc/unicode/case-folding.rb: Remove check for U+03B9/U+03BC/U+A64B. This and the previous few related commits make sure that we won't hit the equivalent of bug #12990 anymore for future updates of Unicode versions. Modified files: trunk/enc/unicode/case-folding.rb trunk/enc/unicode.c Index: enc/unicode/case-folding.rb =================================================================== --- enc/unicode/case-folding.rb (revision 56975) +++ enc/unicode/case-folding.rb (revision 56976) @@ -305,11 +305,7 @@ class CaseMapping https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L305 when item.upper then flags += '|U' when item.lower then flags += '|D' else - unless from=='03B9' or from=='03BC' or from=='A64B' - # cf. code==0x03B9||code==0x03BC||code==0xA64B in enc/unicode.c, - # towards the end of function onigenc_unicode_case_map - raise "Unpredicted case 0 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/." - end + raise "Unpredicted case 0 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/." end unless item.upper == item.title if item.code == item.title Index: enc/unicode.c =================================================================== --- enc/unicode.c (revision 56975) +++ enc/unicode.c (revision 56976) @@ -768,19 +768,10 @@ onigenc_unicode_case_map(OnigCaseFoldTyp https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L768 } } } - else if ((folded = onigenc_unicode_unfold1_lookup(code)) != 0) { /* data about character found in CaseUnfold_11_Table */ - if (flags&OnigCaseFoldFlags(folded->n)) { /* needs and data availability match */ - MODIFIED; - if (flags&OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) - code = folded->code[1]; - else - code = folded->code[0]; - } - else if ((flags&(ONIGENC_CASE_UPCASE)) - && (code==0x03B9||code==0x03BC||code==0xA64B)) { /* GREEK SMALL LETTERs IOTA/MU, */ - MODIFIED; /* CYRILLIC SMALL LETTER MONOGRAPH UK */ - code = folded->code[1]; - } + else if ((folded = onigenc_unicode_unfold1_lookup(code)) != 0 /* data about character found in CaseUnfold_11_Table */ + && flags&OnigCaseFoldFlags(folded->n)) { /* needs and data availability match */ + MODIFIED; + code = folded->code[(flags&OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) ? 1 : 0]; } } to += ONIGENC_CODE_TO_MBC(enc, code, to); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/