diff options
author | Andy Lester <andy@petdance.com> | 2017-02-17 19:46:15 -0600 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-02-18 12:19:54 +0000 |
commit | 19742f39bfbfba7529a49232271b390bc4e811cb (patch) | |
tree | 7c4bc6dcc2549314279de41e4b84ca22d3af270e /pp.c | |
parent | d8f2fe0966b076afb4b85eb04d1524b6af37e344 (diff) | |
download | perl-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.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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); } |