summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-11-11 10:28:44 -0700
committerKarl Williamson <public@khwilliamson.com>2011-11-11 13:30:59 -0700
commit3e16b0e6b272793e45264c51c808855983e8c26d (patch)
treefac10a5d80acde421ef5fda67aee8895a30dfb1b /pp.c
parente67da29c79beab5029f45b828e2315759ffca351 (diff)
downloadperl-3e16b0e6b272793e45264c51c808855983e8c26d.tar.gz
pp.c: Call subroutine instead of repeat code
Now that toUPPER_utf8() has the intelligence to skip going out to swashes for Latin1 code points, it's not so critical to bypass calling it for these (for speed). It simplifies things not to have the intelligence repeated. There is the additional overhead of two function calls (minus the branches saved), but these could be avoided if it comes down to it by making them in-line.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/pp.c b/pp.c
index 12e69e421b..f58a46081b 100644
--- a/pp.c
+++ b/pp.c
@@ -3867,7 +3867,11 @@ PP(pp_uc)
bool in_iota_subscript = FALSE;
while (s < send) {
+ STRLEN u;
+ STRLEN ulen;
+ UV uv;
if (in_iota_subscript && ! is_utf8_mark(s)) {
+
/* A non-mark. Time to output the iota subscript */
#define GREEK_CAPITAL_LETTER_IOTA 0x0399
#define COMBINING_GREEK_YPOGEGRAMMENI 0x0345
@@ -3876,30 +3880,11 @@ PP(pp_uc)
in_iota_subscript = FALSE;
}
- /* If the UTF-8 character is invariant, then it is in the range
- * known by the standard macro; result is only one byte long */
- if (UTF8_IS_INVARIANT(*s)) {
- *d++ = toUPPER(*s);
- s++;
- }
- else if (UTF8_IS_DOWNGRADEABLE_START(*s)) {
-
- /* Likewise, if it fits in a byte, its case change is in our
- * table */
- U8 orig = TWO_BYTE_UTF8_TO_UNI(*s, *(s+1));
- U8 upper = toUPPER_LATIN1_MOD(orig);
- CAT_TWO_BYTE_UNI_UPPER_MOD(d, orig, upper);
- s += 2;
- }
- else {
-
- /* Otherwise, need the general UTF-8 case. Get the changed
- * case value and copy it to the output buffer */
+ /* Then handle the current character. Get the changed case
+ * value and copy it to the output buffer */
- const STRLEN u = UTF8SKIP(s);
- STRLEN ulen;
-
- const UV uv = toUPPER_utf8(s, tmpbuf, &ulen);
+ u = UTF8SKIP(s);
+ uv = toUPPER_utf8(s, tmpbuf, &ulen);
if (uv == GREEK_CAPITAL_LETTER_IOTA
&& utf8_to_uvchr(s, 0) == COMBINING_GREEK_YPOGEGRAMMENI)
{
@@ -3923,7 +3908,6 @@ PP(pp_uc)
d += ulen;
}
s += u;
- }
}
if (in_iota_subscript) {
CAT_UNI_TO_UTF8_TWO_BYTE(d, GREEK_CAPITAL_LETTER_IOTA);