This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Reorder if/else branches
authorKarl Williamson <khw@cpan.org>
Mon, 26 Dec 2016 04:53:04 +0000 (21:53 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 3 Jan 2017 04:46:41 +0000 (21:46 -0700)
It is easier to read code if the trivial branch is follows immediately
after the 'if'.

toke.c

diff --git a/toke.c b/toke.c
index 7836710..59d0cf3 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -3420,7 +3420,10 @@ S_scan_const(pTHX_ char *start)
                        has_utf8 = TRUE;
                     }
 
-                    if (has_utf8) {
+                    if (! has_utf8) {
+                       *d++ = (char)uv;
+                    }
+                   else {
                        /* Usually, there will already be enough room in 'sv'
                         * since such escapes are likely longer than any UTF-8
                         * sequence they can end up as.  This isn't the case on
@@ -3445,9 +3448,6 @@ S_scan_const(pTHX_ char *start)
                                (PL_lex_repl ? OPpTRANS_FROM_UTF
                                             : OPpTRANS_TO_UTF);
                        }
-                    }
-                   else {
-                       *d++ = (char)uv;
                    }
                }
 #ifdef EBCDIC