This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c:incline: Move code into the block that uses it
authorFather Chrysostomos <sprout@cpan.org>
Mon, 5 Aug 2013 06:54:59 +0000 (23:54 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 5 Aug 2013 09:23:32 +0000 (02:23 -0700)
Setting up the values of these variables is pointless if we are not
going to be using them.  They are only used inside the ‘if’ block that
this patch moves them into.

toke.c

diff --git a/toke.c b/toke.c
index 13265e1..d891372 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1753,27 +1753,27 @@ S_incline(pTHX_ const char *s)
 
     if (t - s > 0) {
        const STRLEN len = t - s;
-       SV *const temp_sv = CopFILESV(PL_curcop);
-       const char *cf;
-       STRLEN tmplen;
-
-       if (temp_sv) {
-           cf = SvPVX(temp_sv);
-           tmplen = SvCUR(temp_sv);
-       } else {
-           cf = NULL;
-           tmplen = 0;
-       }
-
        if (!PL_rsfp && !PL_parser->filtered) {
            /* must copy *{"::_<(eval N)[oldfilename:L]"}
             * to *{"::_<newfilename"} */
            /* However, the long form of evals is only turned on by the
               debugger - usually they're "(eval %lu)" */
+           SV *const temp_sv = CopFILESV(PL_curcop);
+           const char *cf;
+           STRLEN tmplen;
            char smallbuf[128];
            char *tmpbuf;
            GV **gvp;
            STRLEN tmplen2 = len;
+
+           if (temp_sv) {
+               cf = SvPVX(temp_sv);
+               tmplen = SvCUR(temp_sv);
+           } else {
+               cf = NULL;
+               tmplen = 0;
+           }
+
            if (tmplen + 2 <= sizeof smallbuf)
                tmpbuf = smallbuf;
            else