In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/476fafdab0f423a4d1cc03f8d41ba35a50245764?hp=313d8687ce0c497b3d341cac2a572742e55a144c>

- Log -----------------------------------------------------------------
commit 476fafdab0f423a4d1cc03f8d41ba35a50245764
Author: David Mitchell <[email protected]>
Date:   Wed Aug 10 09:30:55 2016 +0100

    dump.c: dump physical, not logical, AVs
    
    Perl_do_sv_dump() (as used by Devel::Peek) dumped a logical AV - i.e.
    if it was tied, it called tie methods to get its size and to get its
    elements.
    
    Instead, dump the physical fields in the AV - e.g. a tied AV will likely
    have a FILL of -1 and no elements.
-----------------------------------------------------------------------

Summary of changes:
 dump.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/dump.c b/dump.c
index 5b3dfca..fd3d7cc 100644
--- a/dump.c
+++ b/dump.c
@@ -1672,14 +1672,16 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, 
I32 nest, I32 maxnest, bo
        if (AvREIFY(sv))        sv_catpv(d, ",REIFY");
        Perl_dump_indent(aTHX_ level, file, "  FLAGS = (%s)\n",
                         SvCUR(d) ? SvPVX_const(d) + 1 : "");
-       if (nest < maxnest && av_tindex(MUTABLE_AV(sv)) >= 0) {
+       if (nest < maxnest && AvARRAY(MUTABLE_AV(sv))) {
            SSize_t count;
-           for (count = 0; count <=  av_tindex(MUTABLE_AV(sv)) && count < 
maxnest; count++) {
-               SV** const elt = av_fetch(MUTABLE_AV(sv),count,0);
-
+            SV **svp = AvARRAY(MUTABLE_AV(sv));
+           for (count = 0;
+                 count <= AvFILLp(MUTABLE_AV(sv)) && count < maxnest;
+                 count++, svp++)
+            {
+               SV* const elt = *svp;
                Perl_dump_indent(aTHX_ level + 1, file, "Elt No. %"IVdf"\n", 
(IV)count);
-               if (elt)
-                   do_sv_dump(level+1, file, *elt, nest+1, maxnest, dumpops, 
pvlim);
+                do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, 
pvlim);
            }
        }
        break;

--
Perl5 Master Repository

Reply via email to