diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-15 07:29:51 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-15 07:29:51 +0000 |
commit | e89232eb15857daae7bc8cbeec98c253a6e8a9f2 (patch) | |
tree | 5ac55e58b7a21b29c4045938c90e4580a5ad136c /enc/unicode.c | |
parent | 8679f113e949e2484f105fa27a1334342c244b3c (diff) |
* enc/unicode.c: Eliminating common code.
(with Kimihito Matsui)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc/unicode.c')
-rw-r--r-- | enc/unicode.c | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/enc/unicode.c b/enc/unicode.c index a52bb3324c..5087c55a07 100644 --- a/enc/unicode.c +++ b/enc/unicode.c @@ -716,7 +716,6 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP, 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(OnigCaseFoldType* flagP, 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; } } } |