summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2017-02-17 19:46:15 -0600
committerDavid Mitchell <davem@iabyn.com>2017-02-18 12:19:54 +0000
commit19742f39bfbfba7529a49232271b390bc4e811cb (patch)
tree7c4bc6dcc2549314279de41e4b84ca22d3af270e /pp.c
parentd8f2fe0966b076afb4b85eb04d1524b6af37e344 (diff)
downloadperl-19742f39bfbfba7529a49232271b390bc4e811cb.tar.gz
Moving variables to their innermost scope.
Some vars have been tagged as const because they do not change in their new scopes. In pp_reverse in pp.c, I32 tmp is only used to hold a char, so is changed to char.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/pp.c b/pp.c
index 3e6b891f25..4bd5f0fb68 100644
--- a/pp.c
+++ b/pp.c
@@ -5652,8 +5652,6 @@ PP(pp_reverse)
}
else {
char *up;
- char *down;
- I32 tmp;
dTARGET;
STRLEN len;
@@ -5666,6 +5664,7 @@ PP(pp_reverse)
up = SvPV_force(TARG, len);
if (len > 1) {
+ char *down;
if (DO_UTF8(TARG)) { /* first reverse each character */
U8* s = (U8*)SvPVX(TARG);
const U8* send = (U8*)(s + len);
@@ -5682,9 +5681,9 @@ PP(pp_reverse)
down = (char*)(s - 1);
/* reverse this character */
while (down > up) {
- tmp = *up;
+ const char tmp = *up;
*up++ = *down;
- *down-- = (char)tmp;
+ *down-- = tmp;
}
}
}
@@ -5692,9 +5691,9 @@ PP(pp_reverse)
}
down = SvPVX(TARG) + len - 1;
while (down > up) {
- tmp = *up;
+ const char tmp = *up;
*up++ = *down;
- *down-- = (char)tmp;
+ *down-- = tmp;
}
(void)SvPOK_only_UTF8(TARG);
}