This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_formline: restruture FF_LINEGLOB
authorDavid Mitchell <davem@iabyn.com>
Sat, 28 May 2011 13:52:41 +0000 (14:52 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 29 May 2011 19:21:52 +0000 (20:21 +0100)
change

    if (linebreak) {
        decl;
        ....
    }

to
    decl;
    if (!linebreak)
        break;

    {
        ....
    }

shouldn't change the meaning of the code but will allow us to remove one
level of indentation and begin to reuse that block of code

pp_ctl.c

index 2817c12..ccd1676 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -889,14 +889,16 @@ PP(pp_formline)
            {
                const bool oneline = fpc[-1] == FF_LINESNGL;
                const char *s = item = SvPV_const(sv, len);
+               const char *const send = s + len;
+               STRLEN to_copy = len;
+               const U8 *source = (const U8 *) s;
+               U8 *tmp = NULL;
+
                item_is_utf8 = DO_UTF8(sv);
                itemsize = len;
-               if (itemsize) {
-                   STRLEN to_copy = itemsize;
-                   const char *const send = s + len;
-                   const U8 *source = (const U8 *) s;
-                   U8 *tmp = NULL;
-
+               if (!itemsize)
+                   break;
+               {
                    gotsome = TRUE;
                    chophere = s + itemsize;
                    while (s < send) {