In 5.10 the struct slot was eliminated, and contents are now stored in magic,
which will already be found. Whilst there's no direct "harm" in looking again,
as the "seen" tracker will skip the second discovery, it's wasteful, and now
generates a compilation error, as AvARYLEN() expects a mutable pointer, whereas
the variable thing is const void *.
This also resolves CPAN RT #49437 - Devel::Size adds magic in Perl 5.10
Revision history for Perl extension Devel::Size.
+0.72_50 2011-04-14 nicholas
+ * Resolve CPAN #49437 (Devel::Size adds magic in Perl 5.10)
+
0.72 2008-10-14 BrowserUk 70 tests
* Added bit-vector pointer tracking mechanism.
- new fatal error (64-bit platforms only)
if (AvALLOC(thing) != 0) {
total_size += (sizeof(SV *) * (AvARRAY(thing) - AvALLOC(thing)));
}
- /* Is there something hanging off the arylen element? */
+#if (PERL_VERSION < 9)
+ /* Is there something hanging off the arylen element?
+ Post 5.9.something this is stored in magic, so will be found there,
+ and Perl_av_arylen_p() takes a non-const AV*, hence compilers rightly
+ complain about AvARYLEN() passing thing to it. */
if (AvARYLEN(thing)) {
if (check_new(tv, AvARYLEN(thing))) {
total_size += thing_size(AvARYLEN(thing), tv);
}
}
+#endif
total_size += magic_size(thing, tv);
TAG;break;
case SVt_PVHV: TAG;