Skip to content

Commit fa8f275

Browse files
committed
pp.c: Change a few variable names in pp_uc and pp_lc
I found these confusing
1 parent 8d0a0f0 commit fa8f275

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

pp.c

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4525,11 +4525,11 @@ PP_wrapped(pp_uc, 1, 0)
45254525
bool in_iota_subscript = FALSE;
45264526

45274527
while (s < send) {
4528-
STRLEN u;
4529-
STRLEN ulen;
4528+
STRLEN this_len;
4529+
STRLEN upper_len;
45304530
UV uv;
45314531
if (UNLIKELY(in_iota_subscript)) {
4532-
UV cp = utf8_to_uv_or_die(s, send, &u);
4532+
UV cp = utf8_to_uv_or_die(s, send, &this_len);
45334533

45344534
if (! _invlist_contains_cp(PL_utf8_mark, cp)) {
45354535

@@ -4540,16 +4540,17 @@ PP_wrapped(pp_uc, 1, 0)
45404540
}
45414541
}
45424542
else {
4543-
u = UTF8SKIP(s);
4543+
this_len = UTF8SKIP(s);
45444544
}
45454545

45464546
/* Then handle the current character. Get the changed case value
45474547
* and copy it to the output buffer */
45484548

45494549
#ifdef USE_LOCALE_CTYPE
4550-
uv = _toUPPER_utf8_flags(s, send, tmpbuf, &ulen, IN_LC_RUNTIME(LC_CTYPE));
4550+
uv = _toUPPER_utf8_flags(s, send, tmpbuf, &upper_len,
4551+
IN_LC_RUNTIME(LC_CTYPE));
45514552
#else
4552-
uv = _toUPPER_utf8_flags(s, send, tmpbuf, &ulen, 0);
4553+
uv = _toUPPER_utf8_flags(s, send, tmpbuf, &upper_len, 0);
45534554
#endif
45544555
if ( uv == GREEK_CAPITAL_LETTER_IOTA
45554556
&& utf8_to_uv_or_die(s, send, 0) ==
@@ -4558,7 +4559,9 @@ PP_wrapped(pp_uc, 1, 0)
45584559
in_iota_subscript = TRUE;
45594560
}
45604561
else {
4561-
if (ulen > u && (SvLEN(dest) < (min += ulen - u))) {
4562+
if ( upper_len > this_len
4563+
&& (SvLEN(dest) < (min += upper_len - this_len)))
4564+
{
45624565
/* If the eventually required minimum size outgrows the
45634566
* available space, we need to grow. */
45644567
const UV o = d - (U8*)SvPVX_const(dest);
@@ -4571,10 +4574,10 @@ PP_wrapped(pp_uc, 1, 0)
45714574
* another option */
45724575
d = o + (U8*) SvGROW(dest, min);
45734576
}
4574-
Copy(tmpbuf, d, ulen, U8);
4575-
d += ulen;
4577+
Copy(tmpbuf, d, upper_len, U8);
4578+
d += upper_len;
45764579
}
4577-
s += u;
4580+
s += this_len;
45784581
}
45794582
if (in_iota_subscript) {
45804583
*d++ = UTF8_TWO_BYTE_HI(GREEK_CAPITAL_LETTER_IOTA);
@@ -4868,12 +4871,13 @@ PP_wrapped(pp_lc, 1, 0)
48684871
bool remove_dot_above = FALSE;
48694872

48704873
while (s < send) {
4871-
const STRLEN u = UTF8SKIP(s);
4872-
STRLEN ulen;
4874+
const STRLEN this_len = UTF8SKIP(s);
4875+
STRLEN lower_len;
48734876

48744877
#ifdef USE_LOCALE_CTYPE
48754878

4876-
_toLOWER_utf8_flags(s, send, tmpbuf, &ulen, IN_LC_RUNTIME(LC_CTYPE));
4879+
_toLOWER_utf8_flags(s, send, tmpbuf, &lower_len,
4880+
IN_LC_RUNTIME(LC_CTYPE));
48774881

48784882
/* If we are in a Turkic locale, we have to do more work. As noted
48794883
* in the comments for lcfirst, there is a special case if a 'I'
@@ -4888,9 +4892,10 @@ PP_wrapped(pp_lc, 1, 0)
48884892
&& IN_LC_RUNTIME(LC_CTYPE))
48894893
{
48904894
if ( UNLIKELY(remove_dot_above)
4891-
&& memBEGINs(tmpbuf, sizeof(tmpbuf), COMBINING_DOT_ABOVE_UTF8))
4895+
&& memBEGINs(tmpbuf, sizeof(tmpbuf),
4896+
COMBINING_DOT_ABOVE_UTF8))
48924897
{
4893-
s += u;
4898+
s += this_len;
48944899
remove_dot_above = FALSE;
48954900
continue;
48964901
}
@@ -4901,15 +4906,16 @@ PP_wrapped(pp_lc, 1, 0)
49014906
#else
49024907
PERL_UNUSED_VAR(remove_dot_above);
49034908

4904-
_toLOWER_utf8_flags(s, send, tmpbuf, &ulen, 0);
4909+
_toLOWER_utf8_flags(s, send, tmpbuf, &lower_len, 0);
49054910
#endif
49064911

49074912
/* Here is where we would do context-sensitive actions for the
49084913
* Greek final sigma. See the commit message for 86510fb15 for why
49094914
* there isn't any */
49104915

4911-
if (ulen > u && (SvLEN(dest) < (min += ulen - u))) {
4912-
4916+
if ( lower_len > this_len
4917+
&& (SvLEN(dest) < (min += lower_len - this_len)))
4918+
{
49134919
/* If the eventually required minimum size outgrows the
49144920
* available space, we need to grow. */
49154921
const UV o = d - (U8*)SvPVX_const(dest);
@@ -4925,9 +4931,9 @@ PP_wrapped(pp_lc, 1, 0)
49254931

49264932
/* Copy the newly lowercased letter to the output buffer we're
49274933
* building */
4928-
Copy(tmpbuf, d, ulen, U8);
4929-
d += ulen;
4930-
s += u;
4934+
Copy(tmpbuf, d, lower_len, U8);
4935+
d += lower_len;
4936+
s += this_len;
49314937
} /* End of looping through the source string */
49324938
SvUTF8_on(dest);
49334939
*d = '\0';
@@ -5131,19 +5137,19 @@ PP_wrapped(pp_fc, 1, 0)
51315137

51325138
if (DO_UTF8(source)) { /* UTF-8 flagged string. */
51335139
while (s < send) {
5134-
const STRLEN u = UTF8SKIP(s);
5140+
const STRLEN this_len = UTF8SKIP(s);
51355141
STRLEN ulen;
51365142

51375143
_toFOLD_utf8_flags(s, send, tmpbuf, &ulen, flags);
51385144

5139-
if (ulen > u && (SvLEN(dest) < (min += ulen - u))) {
5145+
if (ulen > this_len && (SvLEN(dest) < (min += ulen - this_len))) {
51405146
const UV o = d - (U8*)SvPVX_const(dest);
51415147
d = o + (U8*) SvGROW(dest, min);
51425148
}
51435149

51445150
Copy(tmpbuf, d, ulen, U8);
51455151
d += ulen;
5146-
s += u;
5152+
s += this_len;
51475153
}
51485154
SvUTF8_on(dest);
51495155
} /* Unflagged string */

0 commit comments

Comments
 (0)