Remove commented out code from the pre-0.72 HV based tracking system.
[p5sagit/Devel-Size.git] / Size.xs
diff --git a/Size.xs b/Size.xs
index d0f4d29..347dd1b 100644 (file)
--- a/Size.xs
+++ b/Size.xs
@@ -3,6 +3,11 @@
 #include "XSUB.h"
 #include "ppport.h"
 
+/* Not yet in ppport.h */
+#ifndef CvISXSUB
+#  define CvISXSUB(cv)  (CvXSUB(cv) ? TRUE : FALSE)
+#endif
+
 #ifdef _MSC_VER 
 /* "structured exception" handling is a Microsoft extension to C and C++.
    It's *not* C++ exception handling - C++ exception handling can't capture
@@ -667,11 +672,18 @@ UV thing_size(const SV * const orig_thing, TRACKING *tv) {
     if (check_new(tv, CvOUTSIDE(thing))) {
       total_size += thing_size((SV *)CvOUTSIDE(thing), tv);
     }
-    if (check_new(tv, CvSTART(thing))) {
-      total_size += op_size(CvSTART(thing), tv);
-    }
-    if (check_new(tv, CvROOT(thing))) {
-      total_size += op_size(CvROOT(thing), tv);
+    if (CvISXSUB(thing)) {
+       SV *sv = cv_const_sv((CV *)thing);
+       if (sv) {
+           total_size += thing_size(sv, tv);
+       }
+    } else {
+       if (check_new(tv, CvSTART(thing))) {
+           total_size += op_size(CvSTART(thing), tv);
+       }
+       if (check_new(tv, CvROOT(thing))) {
+           total_size += op_size(CvROOT(thing), tv);
+       }
     }
 
     TAG;break;
@@ -785,8 +797,6 @@ size(orig_thing)
 CODE:
 {
   SV *thing = orig_thing;
-  /* Hash to track our seen pointers */
-  //HV *tracking_hash = newHV();
   SV *warn_flag;
   TRACKING *tv;
   Newz( 0xfc0ff, tv, 1, TRACKING );
@@ -828,8 +838,6 @@ total_size(orig_thing)
 CODE:
 {
   SV *thing = orig_thing;
-  /* Hash to track our seen pointers */
-  //HV *tracking_hash;
   TRACKING *tv;
   /* Array with things we still need to do */
   AV *pending_array;
@@ -852,7 +860,6 @@ CODE:
   }
 
   /* init these after the go_yell above */
-  //tracking_hash = newHV();
   Newz( 0xfc0ff, tv, 1, TRACKING );
   pending_array = newAV();