This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_sort.c: Remove useless assignments; reduce var scope
authorFather Chrysostomos <sprout@cpan.org>
Sat, 2 Nov 2013 19:38:41 +0000 (12:38 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 4 Nov 2013 13:10:18 +0000 (05:10 -0800)
6cda7db16df9 stopped the value of the stash variable from being used,
so there is no longer any need to assign to it.  sv_2cv, however,
requires an HV ** argument, so we cannot eliminate it completely.

pp_sort.c

index e517bc4..c8fe08e 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1479,7 +1479,6 @@ PP(pp_sort)
     SV **p1 = ORIGMARK+1, **p2;
     SSize_t max, i;
     AV* av = NULL;
-    HV *stash;
     GV *gv;
     CV *cv = NULL;
     I32 gimme = GIMME;
@@ -1517,10 +1516,10 @@ PP(pp_sort)
            kid = kUNOP->op_first;                      /* pass rv2gv */
            kid = kUNOP->op_first;                      /* pass leave */
            PL_sortcop = kid->op_next;
-           stash = CopSTASH(PL_curcop);
        }
        else {
            GV *autogv = NULL;
+           HV *stash;
            cv = sv_2cv(*++MARK, &stash, &gv, GV_ADD);
          check_cv:
            if (cv && SvPOK(cv)) {
@@ -1568,7 +1567,6 @@ PP(pp_sort)
     }
     else {
        PL_sortcop = NULL;
-       stash = CopSTASH(PL_curcop);
     }
 
     /* optimiser converts "@a = sort @a" to "sort \@a";