X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Size.xs;h=248637c28238cb5d325eeb8dc3f74187ec197719;hb=5c2e1b1290f2cc1677c307216577384513f45430;hp=dd61be7ce83b80b65b8f6fd25569834760047cf0;hpb=6a9ad7ec3939b34abe8422bd16196591d78ef98b;p=p5sagit%2FDevel-Size.git diff --git a/Size.xs b/Size.xs index dd61be7..248637c 100644 --- a/Size.xs +++ b/Size.xs @@ -165,10 +165,19 @@ UV thing_size(SV *orig_thing, HV *tracking_hash) { break; case SVt_PVCV: total_size += sizeof(XPVCV); + total_size += magic_size(thing, tracking_hash); carp("CV isn't complete"); break; case SVt_PVGV: + total_size += magic_size(thing, tracking_hash); total_size += sizeof(XPVGV); + total_size += GvNAMELEN(thing); + /* Is there something hanging off the glob? */ + if (GvGP(thing)) { + if (check_new(tracking_hash, GvGP(thing))) { + total_size += sizeof(GP); + } + } carp("GC isn't complete"); break; case SVt_PVFM: @@ -234,13 +243,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 +280,18 @@ CODE: break; case SVt_PVHV: + /* Is there anything in here? */ + if (hv_iterinit((HV *)thing)) { + HE *temp_he; + while (temp_he = hv_iternext((HV *)thing)) { + av_push(pending_array, hv_iterval((HV *)thing, temp_he)); + } + } break; + case SVt_PVGV: default: - puts("Dunno"); + break; } }