ruby-changes:44878
From: nobu <ko1@a...>
Date: Thu, 1 Dec 2016 09:34:47 +0900 (JST)
Subject: [ruby-changes:44878] nobu:r56951 (trunk): constify CaseMappingSpecials
nobu 2016-12-01 09:34:41 +0900 (Thu, 01 Dec 2016) New Revision: 56951 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56951 Log: constify CaseMappingSpecials Modified files: trunk/enc/unicode/9.0.0/casefold.h trunk/enc/unicode/case-folding.rb trunk/enc/unicode.c Index: enc/unicode/case-folding.rb =================================================================== --- enc/unicode/case-folding.rb (revision 56950) +++ enc/unicode/case-folding.rb (revision 56951) @@ -326,7 +326,7 @@ class CaseMapping https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L326 end def specials_output - "OnigCodePoint CaseMappingSpecials[] = {\n" + + "static const OnigCodePoint CaseMappingSpecials[] = {\n" + @specials.map do |sps| ' ' + sps.map do |sp| chars = sp.split(/ /) Index: enc/unicode/9.0.0/casefold.h =================================================================== --- enc/unicode/9.0.0/casefold.h (revision 56950) +++ enc/unicode/9.0.0/casefold.h (revision 56951) @@ -6931,7 +6931,7 @@ onigenc_unicode_CaseUnfold_13_lookup(con https://github.com/ruby/ruby/blob/trunk/enc/unicode/9.0.0/casefold.h#L6931 return 0; } -OnigCodePoint CaseMappingSpecials[] = { +static const OnigCodePoint CaseMappingSpecials[] = { L(1)|0x039C, L(2)|0x0053, 0x0073, L(2)|0x0053, 0x0053, L(2)|0x02BC, 0x004E, Index: enc/unicode.c =================================================================== --- enc/unicode.c (revision 56950) +++ enc/unicode.c (revision 56951) @@ -725,7 +725,7 @@ onigenc_unicode_case_map(OnigCaseFoldTyp https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L725 MODIFIED; if (flags&OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_SPECIALS) { /* special */ - OnigCodePoint *SpecialsStart = CaseMappingSpecials + OnigSpecialIndexDecode(folded->n); + const OnigCodePoint *SpecialsStart = CaseMappingSpecials + OnigSpecialIndexDecode(folded->n); if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_IS_TITLECASE) { /* swapCASE available */ if ((flags&(ONIGENC_CASE_UPCASE|ONIGENC_CASE_DOWNCASE)) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/