summaryrefslogtreecommitdiff
path: root/dump.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-19 08:42:18 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-19 08:42:18 +0000
commitcbf82dd00c19573e7e274a1d8dda9656bc6e259a (patch)
tree85a421e839c6a91506d7a9f972bf553b2cf43845 /dump.c
parent39cd7a593a348b713bd3e45241789bcc2a458c1a (diff)
downloadperl-cbf82dd00c19573e7e274a1d8dda9656bc6e259a.tar.gz
Calling cv_undef() on the CV created by newCONSTSUB() would leak like
a Jumblie's preferred maritime craft. To free CvFILE for this case, take advantage of the 0 length prototype that will also be there, and hang it from the prototype. To do this properly means changing code to actually pay attention to SvCUR() on prototypes. It turns out that we always know the length of the prototype string, so this may be faster. Certainly, it's a memory saving (even ignoring the leak). p4raw-id: //depot/perl@27896
Diffstat (limited to 'dump.c')
-rw-r--r--dump.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/dump.c b/dump.c
index 5fa6700587..a973a41c19 100644
--- a/dump.c
+++ b/dump.c
@@ -1552,8 +1552,12 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
}
break;
case SVt_PVCV:
- if (SvPOK(sv))
- Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%s\"\n", SvPV_nolen_const(sv));
+ if (SvPOK(sv)) {
+ STRLEN len;
+ const char *const proto = SvPV_const(sv, len);
+ Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%.*s\"\n",
+ (int) len, proto);
+ }
/* FALL THROUGH */
case SVt_PVFM:
do_hv_dump(level, file, " COMP_STASH", CvSTASH(sv));