wrong test for magicalness
[p5sagit/Devel-Size.git] / Size.xs
diff --git a/Size.xs b/Size.xs
index f06f85e..109dd15 100644 (file)
--- a/Size.xs
+++ b/Size.xs
@@ -518,9 +518,16 @@ op_size(pTHX_ const OP * const baseop, struct state *st)
 #endif
 #ifdef USE_ITHREADS
           check_new_and_strlen(st, basecop->cop_file);
+#if PERL_VERSION < 17 || (PERL_VERSION == 17 && PERL_SUBVERSION == 0)
+         /* This pointer is owned by the COP, and freed with it.  */
           check_new_and_strlen(st, basecop->cop_stashpv);
 #else
-         sv_size(aTHX_ st, (SV *)basecop->cop_stash, SOME_RECURSION);
+         /* A per-interpreter pointer for this stash is allocated in
+            PL_stashpad. */
+         if (check_new(st, PL_stashpad + basecop->cop_stashoff))
+             st->total_size += sizeof(PL_stashpad[basecop->cop_stashoff]);
+#endif
+#else
          sv_size(aTHX_ st, (SV *)basecop->cop_filegv, SOME_RECURSION);
 #endif
 
@@ -700,7 +707,7 @@ sv_size(pTHX_ struct state *const st, const SV * const orig_thing,
   }
   st->total_size += sizeof(SV) + body_sizes[type];
 
-  if (type >= SVt_PVMG) {
+  if (SvMAGICAL(thing)) {
       magic_size(aTHX_ thing, st);
   }