#define NV double
#endif
+static int go_yell = 1;
+
/* Checks to see if thing is in the hash. Returns true or false, and
notes thing in the hash.
if (cur_entry->hent_hek) {
/* Hash keys can be shared. Have we seen this before? */
if (check_new(tracking_hash, cur_entry->hent_hek)) {
- total_size += sizeof(HEK);
- total_size += cur_entry->hent_hek->hek_len - 1;
+ total_size += HEK_BASESIZE + cur_entry->hent_hek->hek_len + 2;
}
}
cur_entry = cur_entry->hent_next;
case SVt_PVCV:
total_size += sizeof(XPVCV);
total_size += magic_size(thing, tracking_hash);
- carp("CV isn't complete");
+ if (go_yell) {
+ carp("CV isn't complete");
+ }
break;
case SVt_PVGV:
total_size += magic_size(thing, tracking_hash);
break;
case SVt_PVFM:
total_size += sizeof(XPVFM);
- carp("FM isn't complete");
+ if (go_yell) {
+ carp("FM isn't complete");
+ }
break;
case SVt_PVIO:
total_size += sizeof(XPVIO);
- carp("IO isn't complete");
+ if (go_yell) {
+ carp("IO isn't complete");
+ }
break;
default:
croak("Unknown variable type");
SV *thing = orig_thing;
/* Hash to track our seen pointers */
HV *tracking_hash = newHV();
+ SV *warn_flag;
+
+ /* Check warning status */
+ go_yell = 0;
+
+ if (NULL != (warn_flag = get_sv("Devel::Size::warn", FALSE))) {
+ go_yell = SvIV(warn_flag);
+ }
+
/* If they passed us a reference then dereference it. This is the
only way we can check the sizes of arrays and hashes */
/* Hash to track our seen pointers */
HV *tracking_hash = newHV();
AV *pending_array = newAV();
+ IV size = 0;
+ SV *warn_flag;
+
+ IV count = 0;
/* Size starts at zero */
RETVAL = 0;
+ /* Check warning status */
+ go_yell = 0;
+
+ if (NULL != (warn_flag = get_sv("Devel::Size::warn", FALSE))) {
+ go_yell = SvIV(warn_flag);
+ }
+
+
/* If they passed us a reference then dereference it. This is the
only way we can check the sizes of arrays and hashes */
if (SvOK(thing) && SvROK(thing)) {
}
}
- RETVAL += thing_size(thing, tracking_hash);
+
+ size = thing_size(thing, tracking_hash);
+ RETVAL += size;
}
}