import Devel-Size 0.51 from CPAN
Dan Sugalski [Wed, 9 Oct 2002 18:48:27 +0000 (10:48 -0800)]
git-cpan-module:   Devel-Size
git-cpan-version:  0.51
git-cpan-authorid: DSUGAL
git-cpan-file:     authors/id/D/DS/DSUGAL/Devel-Size-0.51.tar.gz

Size.pm
Size.xs

diff --git a/Size.pm b/Size.pm
index 93472ef..2c46e3f 100644 (file)
--- a/Size.pm
+++ b/Size.pm
@@ -24,7 +24,7 @@ require DynaLoader;
 @EXPORT = qw(
        
 );
-$VERSION = '0.50';
+$VERSION = '0.51';
 
 bootstrap Devel::Size $VERSION;
 
diff --git a/Size.xs b/Size.xs
index dd61be7..e92dbe6 100644 (file)
--- a/Size.xs
+++ b/Size.xs
@@ -234,13 +234,13 @@ CODE:
   av_push(pending_array, thing);
 
   /* Now just yank things off the end of the array until it's done */
-  while (&PL_sv_undef != (thing = av_pop(pending_array))) {
+  while (av_len(pending_array) >= 0) {
+    thing = av_pop(pending_array);
     /* Process it if we've not seen it */
     if (check_new(tracking_hash, thing)) {
-      /* First, is it pointing to or contraining something else? */
-      if (SvOK(thing)) {
+      /* Is it valid? */
+      if (thing) {
        /* Yes, it is. So let's check the type */
-
        switch (SvTYPE(thing)) {
        case SVt_RV:
          av_push(pending_array, SvRV(thing));
@@ -271,10 +271,18 @@ CODE:
          break;
 
        case SVt_PVHV:
+         /* Is there anything in here? */
+         if (hv_iterinit((HV *)thing)) {
+           SV *temp_thing;
+           while (&PL_sv_undef != 
+                  (temp_thing = hv_iternextsv((HV *)thing, NULL, NULL))) {
+             av_push(pending_array, temp_thing);
+           }
+         }
          break;
         
        default:
-         puts("Dunno");
+         break;
        }
       }