Avoid an redundant copy in pp_flop

This copy, which occurs with "a".."z" in list context, has been there
since alphabetic ranges were added in commit b1248f16c (perl 3.0 patch
#17 patch #16, continued).

As a side effect, this:

$ ./miniperl -lwe '()=my $undef1..my $undef2'
Use of uninitialized value in range (or flop) at -e line 1.
Use of uninitialized value in range (or flop) at -e line 1.

becomes this:

$ ./miniperl -lwe '()=my $undef1..my $undef2'
Use of uninitialized value $undef2 in range (or flop) at -e line 1.
Use of uninitialized value in range (or flop) at -e line 1.

which is slightly better. :-)
This commit is contained in:
Father Chrysostomos 2011-10-12 10:01:41 -07:00
parent d889390361
commit c774086b8a
2 changed files with 3 additions and 4 deletions

View File

@ -1330,9 +1330,8 @@ PP(pp_flop)
}
}
else {
SV * const final = sv_mortalcopy(right);
STRLEN len;
const char * const tmps = SvPV_const(final, len);
const char * const tmps = SvPV_const(right, len);
SV *sv = sv_mortalcopy(left);
SvPV_force_nolen(sv);

View File

@ -530,11 +530,11 @@ $v = ($m1 ... $m2);
EXPECT
Use of uninitialized value $m1 in range (or flop) at - line 7.
Use of uninitialized value $m2 in range (or flop) at - line 8.
Use of uninitialized value in range (or flop) at - line 9.
Use of uninitialized value $m2 in range (or flop) at - line 9.
Use of uninitialized value in range (or flop) at - line 9.
Use of uninitialized value $m1 in range (or flop) at - line 12.
Use of uninitialized value $m2 in range (or flop) at - line 13.
Use of uninitialized value in range (or flop) at - line 14.
Use of uninitialized value $m2 in range (or flop) at - line 14.
Use of uninitialized value in range (or flop) at - line 14.
########
use warnings 'uninitialized';