summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-03-29 20:03:18 +0100
committerNicholas Clark <nick@ccl4.org>2009-03-29 20:06:53 +0100
commit99ab892b6470bcd28bad5512a942b608496ebf8f (patch)
tree1614b48285f126c71144d5542a01e75a9b0e6ab6 /sv.c
parent9340c80aaec7d3857f387eea86207c1a9604b2ad (diff)
downloadperl-99ab892b6470bcd28bad5512a942b608496ebf8f.tar.gz
Change Perl_newCONSTSUB() so that a NULL sv generates an empty list return.
Don't call DESTROY if it's a constant subroutine.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 912f51756b..12ca453eb9 100644
--- a/sv.c
+++ b/sv.c
@@ -5656,6 +5656,9 @@ Perl_sv_clear(pTHX_ register SV *const sv)
stash = SvSTASH(sv);
destructor = StashHANDLER(stash,DESTROY);
if (destructor
+ /* A constant subroutine can have no side effects, so
+ don't bother calling it. */
+ && !CvCONST(destructor)
/* Don't bother calling an empty destructor */
&& (CvISXSUB(destructor)
|| CvSTART(destructor)->op_next->op_type != OP_LEAVESUB))