- Applied documentation and sane warning patch from Nigel Sandever
- Taught Devel::Size how to size up IO and globs properly
-0.61 Mon Jun 17 16:19:00 2005
+0.61 Mon Jun 27 16:19:00 2005
- Added more checks for formats
- Got CVs sizing right
+
+0.62 Tue Jun 28 11:59:00 2005
+ - Took out // comments
+ - Added in copyright notice
+ - Some small amount of regex parsing
+ - Suppress multiple copies of each warning on each call
\ No newline at end of file
#include "perl.h"
#include "XSUB.h"
+static int regex_whine;
+static int fm_whine;
+
+
#define carp puts
UV thing_size(SV *, HV *);
typedef enum {
UV regex_size(REGEXP *baseregex, HV *tracking_hash) {
UV total_size = 0;
+ total_size += sizeof(REGEXP);
+ /* Note hte size of the paren offset thing */
+ total_size += sizeof(I32) * baseregex->nparens * 2;
+ total_size += strlen(baseregex->precomp);
+
+ if (go_yell && !regex_whine) {
+ carp("Devel::Size: Calculated sizes for compiled regexes are incomple, and probably always will be");
+ regex_whine = 1;
+ }
+
return total_size;
}
if (check_new(tracking_hash, cPMOPx(baseop)->op_pmnext)) {
total_size += op_size((OP *)cPMOPx(baseop)->op_pmnext, tracking_hash);
}
- // if (check_new(tracking_hash, cPMOPx(baseop)->op_pmregexp)) {
- // total_size += regex_size(cPMOPx(baseop)->op_pmregexp, tracking_hash);
- //}
+ /* This is defined away in perl 5.8.x, but it is in there for
+ 5.6.x */
+#ifdef PM_GETRE
+ if (check_new(tracking_hash, PM_GETRE((cPMOPx(baseop))))) {
+ total_size += regex_size(PM_GETRE(cPMOPx(baseop)), tracking_hash);
+ }
+#else
+ if (check_new(tracking_hash, cPMOPx(baseop)->op_pmregexp)) {
+ total_size += regex_size(cPMOPx(baseop)->op_pmregexp, tracking_hash);
+ }
+#endif
break;
case OPc_SVOP:
total_size += sizeof(struct pmop);
if (check_new(tracking_hash, cLOOPx(baseop)->op_nextop)) {
total_size += op_size(cLOOPx(baseop)->op_nextop, tracking_hash);
}
-// if (check_new(tracking_hash, cLOOPx(baseop)->op_lastop)) {
-// total_size += op_size(cLOOPx(baseop)->op_lastop, tracking_hash);
-// }
+ /* Not working for some reason, but the code's here for later
+ fixing
+ if (check_new(tracking_hash, cLOOPx(baseop)->op_lastop)) {
+ total_size += op_size(cLOOPx(baseop)->op_lastop, tracking_hash);
+ }
+ */
case OPc_COP:
{
COP *basecop;
total_size += thing_size((SV *)CvOUTSIDE(thing), tracking_hash);
}
- if (go_yell) {
+ if (go_yell && !fm_whine) {
carp("Devel::Size: Calculated sizes for FMs are incomplete");
+ fm_whine = 1;
}
break;
case SVt_PVIO:
/* Check warning status */
go_yell = 0;
+ regex_whine = 0;
+ fm_whine = 0;
if (NULL != (warn_flag = perl_get_sv("Devel::Size::warn", FALSE))) {
go_yell = SvIV(warn_flag);
/* Check warning status */
go_yell = 0;
+ regex_whine = 0;
+ fm_whine = 0;
if (NULL != (warn_flag = perl_get_sv("Devel::Size::warn", FALSE))) {
go_yell = SvIV(warn_flag);