* enc/unicode.c: Expansion of some code repetition in preparation for

elimination of common code pieces.
  (with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2016-03-15 07:17:09 +00:00
parent ed921b85dc
commit 8679f113e9
2 changed files with 19 additions and 9 deletions

View File

@ -1,3 +1,9 @@
Tue Mar 15 16:17:09 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/unicode.c: Expansion of some code repetition in preparation for
elimination of common code pieces.
(with Kimihito Matsui)
Tue Mar 15 13:49:23 2016 Martin Duerst <duerst@it.aoyama.ac.jp> Tue Mar 15 13:49:23 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/unicode.c: Additional macros and code to use mapping data in * enc/unicode.c: Additional macros and code to use mapping data in

View File

@ -725,9 +725,7 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
SpecialsStart += SpecialsLengthExtract(*SpecialsStart); SpecialsStart += SpecialsLengthExtract(*SpecialsStart);
} }
if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_DOWN_SPECIAL) { if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_DOWN_SPECIAL) {
if (flags&ONIGENC_CASE_DOWN_SPECIAL) if (!(flags&ONIGENC_CASE_DOWN_SPECIAL))
goto SpecialsCopy;
else
SpecialsStart += SpecialsLengthExtract(*SpecialsStart); SpecialsStart += SpecialsLengthExtract(*SpecialsStart);
} }
/* if we pass here, we know we use special upcasing, and are at the right position */ /* if we pass here, we know we use special upcasing, and are at the right position */
@ -737,12 +735,15 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
if (count==1) if (count==1)
code = SpecialsCodepointExtract(*next); code = SpecialsCodepointExtract(*next);
else if (count==2) { else if (count==2) {
to += ONIGENC_CODE_TO_MBC(enc, SpecialsCodepointExtract(*next++), to); code = SpecialsCodepointExtract(*next++);
to += ONIGENC_CODE_TO_MBC(enc, code, to);
code = *next; code = *next;
} }
else { /* count == 3 */ else { /* count == 3 */
to += ONIGENC_CODE_TO_MBC(enc, SpecialsCodepointExtract(*next++), to); code = SpecialsCodepointExtract(*next++);
to += ONIGENC_CODE_TO_MBC(enc, *next++, to); to += ONIGENC_CODE_TO_MBC(enc, code, to);
code = *next++;
to += ONIGENC_CODE_TO_MBC(enc, code, to);
code = *next; code = *next;
} }
} }
@ -752,12 +753,15 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
if (count==1) if (count==1)
code = *next; code = *next;
else if (count==2) { else if (count==2) {
to += ONIGENC_CODE_TO_MBC(enc, *next++, to); code = *next++;
to += ONIGENC_CODE_TO_MBC(enc, code, to);
code = *next; code = *next;
} }
else { /* count == 3 */ else { /* count == 3 */
to += ONIGENC_CODE_TO_MBC(enc, *next++, to); code = *next++;
to += ONIGENC_CODE_TO_MBC(enc, *next++, to); to += ONIGENC_CODE_TO_MBC(enc, code, to);
code = *next++;
to += ONIGENC_CODE_TO_MBC(enc, code, to);
code = *next; code = *next;
} }
} }