This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op_dump() - remove extra indentation from PMOP
authorDavid Mitchell <davem@iabyn.com>
Sat, 12 Nov 2016 08:05:53 +0000 (08:05 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 12 Nov 2016 16:15:09 +0000 (16:15 +0000)
When dumping a PMOP, it displays the PMOP-specific fields with
an extra set of braces and level of indentation, e.g.

    {
        TYPE = match  ===> 1
        FLAGS = (VOID,SLABBED)
        PRIVATE = (RTIME)
        {
            PMf_PRE /abc/ (RUNTIME)
            PMFLAGS = (SCANFIRST,ALL)
        }
    }

This is visually confusing, because child ops are shown in the same way.
This commit removes the extra indentation:

    {
        TYPE = match  ===> 1
        FLAGS = (VOID,SLABBED)
        PRIVATE = (RTIME)
        PMf_PRE /abc/ (RUNTIME)
        PMFLAGS = (SCANFIRST,ALL)
    }

dump.c

diff --git a/dump.c b/dump.c
index 58c8fcc..be89333 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -657,12 +657,8 @@ Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
 
     PERL_ARGS_ASSERT_DO_PMOP_DUMP;
 
-    if (!pm) {
-       Perl_dump_indent(aTHX_ level, file, "{}\n");
+    if (!pm)
        return;
-    }
-    Perl_dump_indent(aTHX_ level, file, "{\n");
-    level++;
     if (pm->op_pmflags & PMf_ONCE)
        ch = '?';
     else
@@ -698,8 +694,6 @@ Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
        Perl_dump_indent(aTHX_ level, file, "PMFLAGS = (%s)\n", SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : "");
        SvREFCNT_dec_NN(tmpsv);
     }
-
-    Perl_dump_indent(aTHX_ level-1, file, "}\n");
 }
 
 const struct flag_to_name pmflags_flags_names[] = {